Skip to content

ACP has no token-usage field, and no way to express that a provider cannot report usage #2397

Description

@albrand

Summary

The standard ACP surface carries no token-consumption field, so ACP threads produce no thread/tokenUsage/updated events. Nothing expresses that, so downstream an unmeasured turn looks the same as a turn that used nothing.

To be clear about what this is not: the bridge is not dropping anything. On main (42d2c1b), ACP's only usage message is

// packages/provider-bridge-acp/src/wire.ts:246-253
acpUsageUpdateSchema = { sessionUpdate: "usage_update", used, size }   // .passthrough()

— context-window occupancy — and delta-translation.ts:970-983 maps it to { kind: "contextWindow", used, size, estimated: false }. That mapping looks correct. There is simply no token data on the standard surface to forward.

Observation

From bb.db on one host:

SELECT t.provider_id,
       count(DISTINCT t.id) AS threads,
       sum(CASE WHEN e.type LIKE '%turn/completed'        THEN 1 ELSE 0 END) AS completed_turns,
       sum(CASE WHEN e.type = 'thread/tokenUsage/updated' THEN 1 ELSE 0 END) AS usage_events
FROM events e JOIN threads t ON t.id = e.thread_id
GROUP BY t.provider_id ORDER BY completed_turns DESC;
provider threads completed turns tokenUsage/updated
claude-code 62 1932 96
codex 153 570 368
acp-opencode 124 307 0
acp-hermes-agent 38 305 0

Scope of that data, so it isn't read as more than it is: both ACP providers are locally-registered agents rather than anything bb ships, and both run through the same bridge and translation path — so the zeros follow from the schema above rather than from two independent agents. The non-ACP rows are not 1:1 either (claude-code shows 1932 completions against 96 usage events), so no per-turn denominator should be read from this table. The distinct threads reporting a context window are 106 (acp-opencode) and 38 (acp-hermes-agent), so these threads are observed — only their cost is absent.

Why it's awkward downstream

A consumer can detect the absence by joining on events, as the query above does. The cost falls on consumers that instead collapse a missing report to a numeric zero, which is easy to write when the providers you integrate against first all report. That happened in a plugin I maintain: its usage columns are NOT NULL DEFAULT 0, so every ACP row reads as a measured zero and share-style metrics return a confident 0% for ACP threads.

That coercion is mine, not bb's. The general point is only that nothing in the event stream states "this turn produced no report", so correct handling depends on a consumer knowing to look for an absence.

Possible improvement

Optional capability metadata on the provider descriptor:

reportsTokenUsage?: boolean;   // absent = unknown; false = known not to

Absence should mean unknown rather than true — existing and third-party descriptors omit the field, and reading those as capable would assert something unestablished.

A capability rather than a per-turn marker because dialect.ts already lets a vendor stamp _meta side channels and acpUsageUpdateSchema is .passthrough(), so an agent could carry token data without a protocol change. A dialect that does surface tokens sets true; the generic ACP dialect sets false. That way the signal improves as vendors improve instead of hard-coding a limitation, and a consumer decides once per provider.

Its limit, stated plainly: a capability describes what a provider can do, not whether a given turn was measured. If those diverge within a provider it can't express that — I have no evidence they do.

Tests it would need: descriptor parse/serialize round-trip with the field present and absent, and a legacy descriptor with no field staying unknown rather than coerced.

Activity

  1. changed the title [-]ACP providers emit no thread/tokenUsage/updated, so there is no positive signal that a turn produced no usage report[/-] [+]ACP has no token-usage field, and no way to express that a provider cannot report usage[/+] on Aug 25, 2026
  2. added
    providers
    provider-acp
    on Aug 25, 2026
  3. jjanousek commented on Sep 17, 2026

    @jjanousek

    One provider-specific correction to "there is simply no token data on the standard surface to forward", offered because it changes what the fix should be for at least one ACP agent.

    cursor-agent does report token usage. bb just launches it in a mode that cannot carry it.

    Run in its --print mode, its result event carries full usage. Measured on bb 0.43.0 with cursor-agent 2026.09.15, one trivial turn:

    $ cursor-agent --print --output-format stream-json --trust "Reply with exactly: OK."
    {"type":"result","subtype":"success","duration_ms":7352,"is_error":false,"result":"OK.",
     "usage":{"inputTokens":13779,"outputTokens":27,"cacheReadTokens":...}}
    

    Event types emitted in that mode: system, user, thinking, assistant, result.

    bb does not use that mode. From ps on this host, every Cursor worker is launched as:

    cursor-agent --use-system-ca <version>/index.js acp
    

    So the number exists inside the process for every turn and is never asked for. The issue's analysis of the ACP surface looks right to me and I am not disputing it: usage_update carries context-window occupancy and nothing else, and the bridge forwards what it is given. The part I would amend is the conclusion drawn from it.

    Why the distinction matters for the fix. The issue proposes a way to express that a provider cannot report usage. For cursor-agent that would record something untrue, and it would be recorded permanently: the honest statement is "this provider can report usage, and the ACP transport bb selects does not carry it". Those want different remedies — the first is a UI affordance, the second is either an ACP extension or a per-agent capability that says where the number can be fetched instead.

    I have no view on which is right for ACP generally, and other agents may genuinely have nothing to report. Just flagging that "cannot report" is the wrong label for at least this one, and it is cheap to check per agent before the label is applied.

    Happy to test a patch against this install.

  4. albrand commented on Sep 17, 2026

    @albrand
    Author

    Thanks @jjanousek, that's a useful correction, and it catches a real mistake in the change I'd already made.

    I've been running the capability from the issue in my fork. It's in albrand/bb@6efa5c3:

    • backend-contract.ts adds reportsTokenUsage?: boolean to the provider capabilities. Leaving it out means unknown. It never means true.
    • host-policy.ts checks that the field is a boolean. It passes the field through only when it's set, so an older descriptor stays unknown and isn't turned into a value.
    • claude-code and codex declare true.

    Your point applies directly to how the fork handles ACP. plugins/provider-acp/src/declaration.ts sets reportsTokenUsage: false once for every ACP agent, and agents.test.ts checks that value for every entry in KNOWN_ACP_AGENTS. acp-cursor is one of those entries. So the fork currently says "cannot report" about Cursor, which is the untrue, permanent label you described.

    I agree with the distinction. The capability can say what bb's integration receives, but it shouldn't be one value for all of ACP. I'd change it in two ways:

    1. Declare it per agent (or per dialect), not once for all of ACP. An agent whose report ACP doesn't carry, like cursor-agent per your measurement, should be left unset (unknown) rather than false. Only an agent that we've checked and found has nothing to report should get false.
    2. Keep "the agent can't count tokens" separate from "the way bb launches it doesn't pass the count along." These need different fixes: either get the number from somewhere else (for Cursor, the result.usage from --print --output-format stream-json) or add an ACP _meta extension. That work is separate, and I haven't scoped it here.

    I'll change the fork's ACP declaration to per-agent and remove the test that requires false for every agent. If a PR follows, I'd take you up on the offer to test it against your Cursor install.

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

    provider-acpproviders

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions