Repository navigation
A resumed conversation restores its late receipts, so it never saves less than it charged - #2414
Merged
Merged
Conversation
…less than it charged A late provider receipt (a cut stream priced after the fact) is banked outside every turn seal and leaves only its call line with an arm mark. Replay summed usage seals alone, so after a restart the meter forgot every late charge, and the next turn could stamp meta.json below the total a late receipt had already saved (.25 + .125 saved .375; resumed, a .01 turn saved .26). Replay now restores a call line that carries an arm (reconciled or hedge) as one call and no turn, exactly as Agent.reconciled banked it, and Digest.Spend counts the same lines so a meta row rebuilt from the transcript agrees. Ordinary call lines stay evidence and are never billed; Digest.Usage still lists only usage lines. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ll restores it Close lets pending receipt accounting finish after quit, and the closed journal already admitted usage seals for that reason, but it refused the arm call line a late receipt writes. The charge then reached meta.json and vanished on resume again. The closed-file exception now admits a paid arm call line too; ordinary call lines stay refused after close. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The broader rewrite moved the manual's question ranking (TestTheChatManual- AnswersTheQuestionsPeopleAsk); keep the original sentences and add the late-receipt exception beside them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 6, 2026
AbirAbbas
added a commit
that referenced
this pull request
Nov 13, 2026
…red; turn.tool carries live spend (#2612) * turn.tool carries the conversation's live spend so far Carries #2413 from the closed integration PR #2306 (workstreams/main); it never reached dev. Co-Authored-By: Claude Mythos 5.2 <[email protected]> * A resumed conversation restores its late receipts, so it never saves less than it charged Carries #2414 from the closed integration PR #2306 (workstreams/main); it never reached dev. The one conflict, Digest's fields, keeps dev's folded-usage total beside the late-receipt sum. Co-Authored-By: Claude Mythos 5.2 <[email protected]> * session: an abandoned turn's paid steps survive a restart Carries #2440 from the closed integration PR #2306 (workstreams/main); it never reached dev. Co-Authored-By: Claude Mythos 5.2 <[email protected]> * changes: the carried spend entries name this pull request (#2612) Co-Authored-By: Claude Mythos 5.2 <[email protected]> * manual: a late receipt's call line is the one a resume adds up (#2612) The transcript-format section of sessions-and-rewind.md still said every `call` line is never added up. Since this pull request a resume adds a call line marked with an `arm` once, as the usage and call-line sections of the same page already say. The section now names that exception, and a test keeps every paragraph that says call lines are not added up naming the arm beside it. Co-Authored-By: Claude Opus 5.5 <[email protected]> * session: a step seal saves the total Home reads, as a turn seal does (#2612) The abandoned tool-batch, settle-bound and final stage-report exits wrote their step seal to the journal but never stamped meta.json. Their steps bank as turn calls, which Agent.bank leaves for the seal to stamp, so meta.json kept the figure from before them. After a restart the meter (/cost, the status row, agents.budget.get) restored the journal's total while meta.json (agents.list spent_usd, Home) kept the older one, because stampRestoredSpend fills only a missing figure. A .01 title followed by a .25 step at any of the three exits read $0.26 on the meter and $0.01 in meta.json until the next ordinary turn sealed. The three exits now share sealSteps, which writes the step seal without duration and owes the deferred spend stamp. The stamp reads the live books and writes only the spend fields, so it changes nothing a replacement turn owns. The manual and the change entry say so. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Mythos 5.2 <[email protected]>
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
A late provider receipt (a stream cut before its usage block, priced afterwards by
Agent.reconciled) is banked withlate: true, outside every turn seal, and leaves only a journalcallline marked with anarm(reconciledorhedge). Since the late charge is saved to meta.json at once, but replay summed usage seals only, a restart forgot it: .25 sealed + .125 late saved .375; after a resume the meter read .25, and a .01 turn saved .26 — below what had already been charged.sessionfile.go) restores a call line that carries an arm as one call and no turn, with its money and tokens, exactly asAgent.reconciledbanked it. Ordinary call lines stay evidence and are never billed.Digest.Spend()counts the same lines (a separate late sum), so a meta row rebuilt from the transcript (cellindexDerive/Behind) agrees;Digest.Usagestill lists only usage lines for its ledger readers.Close(pending receipt accounting may finish after quit) keeps its arm line: the closed-file exception that already admitted usage seals now admits a paid arm call line too.Checked by reading: every arm line comes from
Agent.reconciled, which banks late exactly once; no seal or abandoned line holds that money; no supported path mirrors a duplicate arm into one journal; late banking (#631) predates arm lines (#1015) and nothing before #631 banked late money, so no older journal double counts. Out of scope and unchanged: an abandoned turn (abandon.go) writes anabandonedrecord without a seal, so its ordinary calls are also absent from replay — a separate gap.Part of the Workstreams plan's spend follow-ups.
Validation contract
TestLateCallLinesRestoreSpendWithoutAddingTurnsTestALateReceiptSurvivesResumeAndTheNextSpendStampTestALateReceiptAfterCloseSurvivesResumeAndTheNextSpendStampTestLateCallLinesRestoreSpendWithoutAddingTurns; existingTestCallLinesAreNotReadBackAsSpendunchangedDigest.Spendanswers .375 whileDigest.Usagekeeps only the usage lineTestDigestSpendIncludesLateReceiptsWithoutAddingUsageLinesNo wire change.
🤖 Generated with Claude Code