mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-24 22:09:14 +00:00
repair Hermes ledger migration fidelity
This commit is contained in:
parent
38e6e19f29
commit
4bebc37f2c
4 changed files with 14 additions and 9 deletions
|
|
@ -22,8 +22,11 @@ import type { CachedCall, ProviderSection } from './session-cache.js'
|
|||
// dropped: sealed days are not re-read. This slice does not bump
|
||||
// DAILY_CACHE_VERSION (one cold re-parse for every user) to recover history.
|
||||
|
||||
export const HERMES_SESSION_LEDGER_FILENAME = 'hermes-session-ledger.v2.json'
|
||||
export const HERMES_SESSION_LEDGER_VERSION = 2 as const
|
||||
// v3 discards the local-only v2 migration candidate. Seeding v2 from the warm
|
||||
// session cache could preserve lifetime totals while assigning historical
|
||||
// observations to the migration day, inflating that day's scoped Hermes spend.
|
||||
export const HERMES_SESSION_LEDGER_FILENAME = 'hermes-session-ledger.v3.json'
|
||||
export const HERMES_SESSION_LEDGER_VERSION = 3 as const
|
||||
|
||||
export type HermesCostBasis = 'actual' | 'estimated' | 'calculated' | 'included'
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ const { version } = require('../package.json')
|
|||
// Bump when the menubar payload's rendering semantics change without a package
|
||||
// release or daily-cache version change. The envelope version in session-cache
|
||||
// protects record shape; this protects the meaning of an otherwise valid one.
|
||||
const STATUS_SNAPSHOT_RENDER_VERSION = 3
|
||||
const STATUS_SNAPSHOT_RENDER_VERSION = 4
|
||||
const STATUS_SNAPSHOT_SEMANTIC_KEY = `${version}:render-${STATUS_SNAPSHOT_RENDER_VERSION}:daily-${DAILY_CACHE_VERSION}`
|
||||
import { loadCurrency, getCurrency, isValidCurrencyCode } from './currency.js'
|
||||
import { CodexThroughputReader, newestCodexSession, renderCodexThroughput } from './codex-throughput.js'
|
||||
|
|
|
|||
|
|
@ -373,9 +373,11 @@ export const PROVIDER_PARSE_VERSIONS: Record<string, string> = {
|
|||
// replays (double-counted before), takes the model from the reporting
|
||||
// assistant/message, and keeps agent-injected context out of the preview.
|
||||
dsh: 'seed-aware-v1',
|
||||
// cost-provenance-v2: preserve Hermes included/estimated/actual status and
|
||||
// rebuild the provider section alongside the v2 lifetime ledger.
|
||||
hermes: 'reasoning-output-accounting-v1-est-cost-routed-ids-workspace-pr-v5-cost-provenance-v2',
|
||||
// cost-provenance-v3: preserve Hermes included/estimated/actual status and
|
||||
// rebuild the provider section alongside the v3 lifetime ledger. The parse
|
||||
// bump is required with the ledger bump: seeding a new ledger from a section
|
||||
// produced under v2 can turn historical accounting deltas into today's use.
|
||||
hermes: 'reasoning-output-accounting-v1-est-cost-routed-ids-workspace-pr-v5-cost-provenance-v3',
|
||||
'lingtai-tui': 'token-ledger-registry-activity-v3',
|
||||
'ibm-bob': 'worktree-project-grouping-v1',
|
||||
// project-path-v1: the parser now records the session's full working
|
||||
|
|
|
|||
|
|
@ -245,9 +245,9 @@ describe('hermes session ledger unit', () => {
|
|||
expect(isHermesLedgerPublicationError(caught)).toBe(true)
|
||||
})
|
||||
|
||||
it('does not adopt a v1 ledger after the cost-provenance contract changes', async () => {
|
||||
await writeFile(join(cacheDir, 'hermes-session-ledger.v1.json'), JSON.stringify({
|
||||
version: 1,
|
||||
it('does not adopt a v2 ledger whose migration could re-date historical observations', async () => {
|
||||
await writeFile(join(cacheDir, 'hermes-session-ledger.v2.json'), JSON.stringify({
|
||||
version: 2,
|
||||
cursors: {
|
||||
default: {
|
||||
corrupt: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue