Repository navigation
Conversation
…ingdotgg#18124) Co-authored-by: Claude Opus 5.5 <[email protected]>
n0ah37
force-pushed
the
feat/context-meter-session-cost
branch
from
October 11, 2026 10:04
acf2bf3 to
7af2498
Compare
…dotgg#18143) Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
n0ah37
force-pushed
the
feat/context-meter-session-cost
branch
from
October 11, 2026 12:19
c354413 to
27a9fe0
Compare
Claude carries a resumed session's earlier cost into the new process's running total, so counting each process from zero charged that history twice. The provider thread now keeps the last total and a resumed process counts from it. A turn stopped before any usage report no longer reads as unpriced, since the next turn's report includes it, and dollars read as Claude Code's /usage prints them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Thread transfer impact
This comment will update automatically after the next completed run. |
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.
The context meter has a cost row, but no provider fills it on the live path, so users never see what a thread has cost. Requested in Ideas discussion pingdotgg#18050 (originally issue pingdotgg#17818).
Change
Each provider turn can now carry
costUsd, the provider's own USD estimate for that turn. The meter's popover adds them up into Session cost.OrchestrationV2ProviderTurn.costUsd, optional, finite and non-negative. The server'supsertProviderTurnand the client projection'sprovider-turn.updatedreducer keep it when a later update omits it, as they already do fortokenUsage.total_cost_usdon a result is the process's running total, not the turn's. The adapter keeps the total already attributed per CLI process and charges each turn the growth (claudeTurnCostUsd). Growth from wake turns with no T3 turn carries into the next turn; a zeroed or unchanged total (crash or replayed results) is ignored; a smaller total means/clearrestarted the count.costfromsession.step.ended/session.step.failed.costfromstep-finishparts. Recorded 1.x transcripts can omitcostdespite the SDK type, so one unpriced step leaves the turn unpriced rather than reporting a partial figure.contextUsage.costkeep showing it. The live-usage path now passes that cost through too, where it used to hard-codenull.USD 0.42 + 3 unpriced turnsrather than passing for the whole session.withThreadCostputs the sum on the meter's snapshot. Mobile has no context meter.docs/user/composer.md.Not included: pricing unpriced providers from the LiteLLM rate table that the Usage page uses. That would need per-turn model and cache-write data that the live turn does not carry, so it is left for a separate change.
Verification
vp test runon the orchestrator and Claude replay fixtures,provider-opencodeadapter tests,ClaudeTurnCost.test.ts,contextWindow.test.ts,ProviderTurnTokenUsage.test.tsandorchestrationV2Projection.test.ts: 214 passed. Themulti_turn/claudeAgentreplay now asserts each turn's cost from the recorded running totals (0.01171425, then 0.0154371 − 0.01171425). This includes the existing OpenCode 1.xsimplereplay, which caught the missing-costcase. Theopencode2_simplereplay now asserts the turn's cost (a free model, so 0).vp test run apps/server/src/orchestration-v2/testkit/ClaudeReplayFixtures.integration.test.ts apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts: passed.typecheckpasses for contracts, client-runtime, provider-opencode, server and web.Built with Claude Opus 5.5 in Claude Code.
🤖 Generated with Claude Code