Repository navigation
feat(insights): real token usage from the member's computer; one row per agent role - #268
Open
hoangsnowy wants to merge 1 commit into
Open
hoangsnowy wants to merge 1 commit into
hoangsnowy wants to merge 1 commit into
Conversation
…per agent role
On the lab Insights showed ~6,000 tokens for three coding runs and two separate "Coding" rows.
- Usage: the runner sends the CLI's own usage from its closing event (the whole agentic run — every tool turn),
normalised so cache reads/writes are a subset of the input (Claude reports input_tokens without them).
RemoteAgentLlmClient uses it; only an older runner or a CLI that reports none falls back to the estimate. Cost on
the server stays $0 (subscription, not billed); Insights derives its ≈ API figure from the real tokens.
- Insights merges buckets by role ("CodingAgent" from the 5-agent pipeline and "Coding" from the Board are one row;
latency is call-weighted).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Seen on the lab after #265: Insights showed ~6,000 tokens for three coding runs (an estimate from prompt length) and two "Coding" rows.
resultevent — the whole agentic run) asRemoteExecResult.InputTokens/OutputTokens/CacheRead/CacheWrite, normalised so cache ⊂ input (Claude'sinput_tokensexcludes cache).RemoteAgentLlmClientuses it; older runners / no usage → the estimate. Server cost stays $0 (subscription); the ≈ API figure comes from real tokens.CodingAgent(pipeline) andCoding(Board); latency call-weighted.Test plan
CliProgressTests: normalised usage; none reported → null.RemoteAgentTests: real usage used (incl. cache), $0 cost; older runner → estimate.InsightsByRoleTests: merge + weighted latency. Full suite green.🤖 Generated with Claude Code
https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB