Repair provider usage and Hermes cost contracts - #1234
Merged
iamtoruk merged 10 commits intoSep 2, 2026
Conversation
…#1132 Two open branches claim daily-cache version 30, so a v30 file on disk carries unknown accounting. Bump this branch to 31 and move the Hermes pending-rederive contract version with it, so a v30 file written under getagentseal#1132's accounting is treated as a foreign prior version: carried forward per slice, never adopted as the finalized base. The getagentseal#946 copilot fixture seeded itself at DAILY_CACHE_VERSION - 5, a moving target that crossed the copilot contract boundary (26) at this bump and silently stopped granting the entitlement those tests exist to check. Pinned to 25, which is the fixed historical version the fixture actually means. Disclosure: the bump re-derives every day whose sources still survive, so finalized history shifts. On the reviewer's machine Claude moved -0.78 percent. That is a corrected figure replacing a stale cached one, not a loss, but it is a visible change to numbers users have already seen.
…s with shrunken parses The provider-scoped overlay blind-set a fresh slice for every date it could produce one. A settled day's sources age off disk continuously, so that fresh slice is a lower bound, not a correction, and the overlay replaced finalized cache days with whatever the surviving files still explained. It ran over the whole period and over the whole history, so the scoped view could report a fraction of the same day the all-provider view served off the same cache. The overlay now routes through mergeDayEntries with guardPartialSurvival: fresh may FILL a (date, provider) the cache lacks and still wins inside the settle window, but it can no longer SHRINK a settled day the cache already holds. Filling has to keep working, because on a cold cache the scoped parse is the only source a historical day has. Measured on this machine over 2026-08-03..2026-09-01, comparing scoped --provider claude against the claude slice of the unscoped run: before $16649.42 / 81812 calls (short by $291.70 and 2507 calls) after $16941.12 / 84319 calls (exact match, both fields)
…pend hasUsage is a new payload field, so every RELEASED CLI omits it. Both decoders treated the absent case as "derive from cost", which is the strict reading of a field that is not there: a provider with $0 spend in the period vanished from the picker even though the user has it and is actively using it on an included subscription. Absent now means visible on both surfaces. The strict signal still applies wherever the CLI actually emits the field, so an explicit false still hides an idle discovery row. Settings.tsx carried the same fallback and is fixed with it.
The loader reads only the v3 path, so a hermes-session-ledger.v1.json from an earlier install sat in the cache dir unread and undeleted. It is dead weight that can only mislead: the parse-version bump forces a cold re-parse that rebuilds every cursor from source, so nothing in it is recoverable. Unlink it when the v3 file is absent. The v2 test this replaces was vacuous. It wrote a v2 file and asserted the ledger was empty, but the loader never looks at a v2 path, so it passed whatever the code did. The replacement uses a real v1 fixture and asserts both halves: the ledger loads empty AND the v1 file is gone afterwards.
iamtoruk
marked this pull request as ready for review
September 2, 2026 18: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.
Summary
providerDetails.hasUsageauthoritative and fail closed for legacy payloadsclaude-fable-5-1display asFable 5.1without another hand-maintained entryVerification
claude-fable-5-1reportsFable 5.1verify:upgradepath: migration, provider parity, stdio parity, worker determinism, warm-cache stability, partial source aging, and durable history41f44edcThis is draft pending maintainer review. The concurrency/reconciliation follow-up is intentionally separated into a dependent draft PR.