Repository navigation
Stop double-billing Claude session history after a restart - #1997
Merged
currentbits merged 2 commits intoNov 11, 2026
Merged
Conversation
#1961) A fresh --resume process restores the session's cumulative totals, and Solenta billed them again from a zero baseline. Keep a versioned per-session checkpoint on the thread (scoped by account, target and config home) and subtract it only when the first resumed result proves restoration through exact per-model counter identities. Unproven resumes report the turn's cost unavailable instead of charging history; warm deltas resume afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
currentbits
deleted the
coder/persist-verified-claude-session-accounti-b24666
branch
November 11, 2026 16:50
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.
Closes #1961.
After a turn completes and the Claude CLI process is replaced (app restart, idle reap, model/effort change), the resumed process reports the session's restored cumulative
total_cost_usdandmodelUsage. Solenta subtracted from a zero baseline, so it re-billed history: the #1960 fixture recorded $0.05 / 26 inputs for a session that cost $0.04 / 16.What changed
electron/claude-usage.js): a versioned per-session record on the thread with the subtraction baseline plus the raw provider-reported totals, scoped by provider/account ref, remote/WSL target andCLAUDE_CONFIG_DIR. Normalized on load (store-migrate.js); old stores get none.--resumeprocess is classified by exact per-model counter identities, never magnitude:runner-provider-claude.js): hydrate only when session ID + scope match and it isn't a fork; write the checkpoint in the same tick/save as the ledger rows, and only while this handle still owns the session.Deviation from the issue: there is no no-generation handshake in Solenta, so exact counter identity on the first result is the proof used instead.
Tests
electron/test/claude-resume-accounting.test.js(16): restore/reset/unknown, legacy reset above and below the old total, partial pre-result usage, malformed checkpoints, replay, captured 2.1.283 frames (classify as reset), and real runner + Store reload across three app lifetimes, model respawn, old store and account-scope mismatch. Resume now records $0.03/14, then $0.04/16, in thread usage, daily spend and per-model cells.claude.test.js/budget-spend.test.jsfakes now declareclaude_code_version: 2.1.276: a version-less, cost-only resumed result is no longer assumed to be a reset.🤖 Generated with Claude Code