Skip to content

fix(claude): track active goal spend from assistant API messages - #471

Merged
SDSLeon merged 1 commit into
masterfrom
poracode/tender-yak-1ccc61df
Aug 3, 2026
Merged

fix(claude): track active goal spend from assistant API messages#471
SDSLeon merged 1 commit into
masterfrom
poracode/tender-yak-1ccc61df

Conversation

@SDSLeon

@SDSLeon SDSLeon commented Aug 3, 2026

Copy link
Copy Markdown
Owner

Tickets: none

  • Active goal token spend now accumulates from per-call assistant API message usage (input + output + cache creation + cache read), deduplicated by sample id, on both the main thread and subagent sidechains.
  • No longer derives goal totals from the turn result usage, which the CLI reports as a session-cumulative counter that mixes pre-goal and sidechain spend into the total.
  • Removed task-lifecycle usage updates that fed cumulative per-task counters into goal totals, which double-counted sidechain spend; task usage now stays on tool progress only.
  • Context-poll handling no longer derives spend from the last-call apiUsage snapshot; it only ticks the goal's elapsed time while assistant messages drive the token total.
  • Updated canonical mapping and session tests to verify exact spend accumulation and exclude session-cumulative counters.

Accumulate per-call assistant token spend (main thread and subagent
sidechains) while a goal is active, instead of deriving it from the
turn result's session-cumulative usage counter. Deduplicate samples by
API message id (with uuid fallback) so replays land once in the ledger;
context-poll ticks no longer derive tokens from apiUsage.
@SDSLeon
SDSLeon merged commit 63c7215 into master Aug 3, 2026
8 checks passed
@SDSLeon
SDSLeon deleted the poracode/tender-yak-1ccc61df branch August 3, 2026 05:15
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.

1 participant