Skip to content

feat(acp): report standard adapter usage - #4950

Open
atishpatel wants to merge 2 commits into
mainfrom
workerbee/acp-prompt-usage
Open

feat(acp): report standard adapter usage#4950
atishpatel wants to merge 2 commits into
mainfrom
workerbee/acp-prompt-usage

Conversation

@atishpatel

Copy link
Copy Markdown
Contributor

Why

Claude Code and Codex expose standard ACP prompt-response usage, but Buzz only consumed Goose’s private cumulative usage notification. Their token use and Claude’s cumulative cost were therefore absent from NIP-AM metrics.

What

  • Read per-turn session/prompt response usage for known Claude and Codex adapters
  • Publish Claude’s raw cumulative cost separately from per-turn tokens without changing the NIP-AM schema
  • Keep Goose usage exclusive and cover Claude/Codex wire serialization

Risk Assessment

Low-to-medium: changes best-effort observability only and does not affect prompt execution. The adapter-specific mappings preserve source semantics and omit unavailable fields.

References

  • Validated with cargo fmt --check, cargo test -p buzz-acp --no-run, and full cargo test -p buzz-acp (678 passed at 652e373a before merge-trailer amendment).

Generated with Codex

Co-authored-by: Atish Patel <atish@squareup.com>
Signed-off-by: Atish Patel <atish@squareup.com>
@atishpatel
atishpatel force-pushed the workerbee/acp-prompt-usage branch from e4de0b4 to e20cb57 Compare August 5, 2026 20:24
…usage

* origin/main:
  fix(buzz-agent): scope handoff cap per turn, not per session lifetime (#4805)
  Fix mobile message timeline bounce (#4862)
  Polish mobile bottom sheets and profile cards (#4911)
  Fix media attachment actions (#4849)
  fix(desktop): remove join API token control (#4897)
  fix(desktop): allow shared agent mentions (#4913)
  Polish mobile top navigation (#4778)
  fix(release): tag immutable desktop candidates (#4811)
  fix(channels): restrict private-channel invitations (#4612)
  fix(acp): reject unattended permission requests (#4609)
  fix(workflow): bind trigger author to the signed event (#4607)
  fix(git): revoke access for banned relay members (#4608)

Co-authored-by: Atish Patel <atish@squareup.com>
Signed-off-by: Atish Patel <atish@squareup.com>
@atishpatel
atishpatel force-pushed the workerbee/acp-prompt-usage branch from e20cb57 to 0540e3d Compare August 5, 2026 21:08
@atishpatel
atishpatel marked this pull request as ready for review August 5, 2026 21:12
@atishpatel
atishpatel requested a review from a team as a code owner August 5, 2026 21:12
@custard-pirate

Copy link
Copy Markdown

I validated this problem independently while building an owner-side NIP-AM usage projection for a mixed Codex/Claude/Goose fleet. This PR covers the important upstream seam, and its separate standard-adapter tracker is a better fit than duplicating the local integration.

Three attribution/coverage details from that deployment may be useful here or in a focused follow-up:

  1. Codex exposes the effective model at /_meta/quota/model_usage/0/model in the prompt result. Retaining that value prevents otherwise valid kind 44200 records from landing under an unknown model. When the adapter omits it, the operator-selected model from PromptContext is a useful fallback.
  2. Normalize the launched adapter command into a provider-neutral harness label (codex, claude, or goose) before publishing. Absolute paths and wrapper names otherwise fragment the dataset.
  3. Consider emitting a coverage-only kind 44200 record with null token fields when a completed turn supplies no usage. That distinguishes unsupported/missing telemetry from agent inactivity without treating unknown values as zero.

Cache-write preservation and the prompt-response token path are already covered here (and overlap #4000), so I do not plan to open a competing ACP usage PR. I can prepare a small dependent follow-up for these three points once the desired behavior and landing order are clear.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants