Skip to content

Built-in claude-code profile emits no usage, leaving every run's accounting unmeasured #121

Description

@vjovanov

Filed by an agent triaging a local report.

What I ran

On rhei v0.3.2 at commit 01aee9d7d89d6c1f6f58e62d88a6f934bc2d81f5 (v0.3.2), I instantiated the shipped supervised-ticket-fix template with one ticket and one review round:

rhei instantiate /home/vjovanov/f/.agents/rhei/templates/supervised-ticket-fix \
  --set ticket=/tmp/rhei-claude-repro/ticket.md \
  --set title='Accounting reproduction' \
  --set rounds=1 --set plan_approval_attempts=1 \
  --output /tmp/rhei-claude-repro-parent.Q5tlxX/workspace

I put a recording claude shim first on PATH to avoid another paid model run. It recorded the arguments, emitted the ordinary text plain Claude response, and exited 0. I then ran:

RHEI_REPRO_ARGV=/tmp/rhei-claude-repro/rhei-argv.txt \
PATH=/tmp/rhei-claude-repro:$PATH \
rhei run --no-tui --parallel 1 \
  /tmp/rhei-claude-repro-parent.Q5tlxX/workspace

The built-in target was invoked with:

--permission-mode
bypassPermissions
-p

There was no --output-format json or --output-format stream-json argument. The installed Claude CLI documents text (default), json, and stream-json as the --output-format choices.

What happened

The agent log contained only:

plain Claude response

The resulting invocation record contained:

{
  "agent": "claude-code",
  "provider": "anthropic",
  "model": "claude-fable-5",
  "extraction_status": "no-usage-emitted",
  "tokens": {
    "total": { "status": "unknown" },
    "input": {
      "total": { "status": "unknown" },
      "cached_read": { "status": "unsupported" },
      "cache_write": { "status": "unsupported" }
    },
    "output": {
      "total": { "status": "unknown" },
      "cached_read": { "status": "unsupported" },
      "cache_write": { "status": "unsupported" }
    }
  },
  "pricing": { "status": "not-applicable" }
}

The summary reported coverage: "none", invocation_count: 1, measured_invocation_count: 0, missing_invocation_count: 1, and cost_micro: null. rhei cost printed:

Cost unpriced | Total - | In - | Out - | Coverage None | Invocations 1

By Node:
  workspace.ticket: unpriced total=- in=- out=- coverage=None

The source shows the mismatch: agent_usage_extractor maps claude-code to StructuredCapture in crates/rhei-cli/src/cli/accounting.rs, while the built-in profile invokes claude with prompt_flag: -p and no output-format option in crates/rhei-cli/src/cli/settings_types.rs. In the default text mode, Claude emits no structured usage for the configured extractor to read. The relevant source is unchanged between v0.3.1 and v0.3.2.

Expected behavior

The built-in profile should invoke Claude in a mode that emits usage, such as --output-format json, so the supported claude-code extractor can populate token and cost accounting. Alternatively, rhei should stop claiming an extractor for claude-code until it can read the profile's output, rather than reporting a coverage figure that can never become measured.

This is specific to the built-in claude-code profile, which is also the default tier selected by the shipped supervised-ticket-fix template. The codex and pi extractors are not implicated.

Four independent rhei run --headless runs of that template, one per foundation project, took roughly 35–64 minutes each and produced no token or cost figure. That prevents measuring the template's cost per ticket, which is needed to choose appropriate tier defaults. No workaround was found without restating the complete built-in agent block in workspace settings.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    high-priorityWrong or misleading verdict a user can still catch, or an adoption blocker

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions