Skip to content

Commit ff37d6d

Browse files
committed
fix(cli): bump backfill state schema to v9
The three Codex/Claude token fixes in this branch change how already- uploaded history should read, so the watermarks have to drop for them to apply retroactively. Next sync re-parses every jsonl and upserts the rebuilt rollups with replace: true — nothing is purged. Claude-Session: https://claude.ai/code/session_019u3RKiNJY1sRknveHJy9iJ
1 parent 22c9f80 commit ff37d6d

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

packages/cli/src/lib/types.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,20 @@ export interface BackfillSourceFile {
4141
// fixes — `session_meta.model_provider` is no longer stored as the model,
4242
// the model is seeded from the first `turn_context`, `codex-auto-review`
4343
// resolves to the review model shipping on that date, and a proxy's
44-
// effort parenthetical is stripped). The CLI compares the
44+
// effort parenthetical is stripped, and the v9 Codex replay-dedup batch —
45+
// a re-emitted `last_token_usage` is dropped when the cumulative
46+
// `total_token_usage` did not advance, and a forked rollout's replayed
47+
// history is matched against its parent's own usage stream instead of the
48+
// same-second heuristic, which missed replays spanning several seconds and
49+
// nested forks, and the v9 Claude advisor fix — `advisor_message` entries in
50+
// `message.usage.iterations[]` are a different model's call that the enclosing
51+
// usage does not carry, so their tokens were being dropped). The CLI compares the
4552
// constant against the on-disk schema; on a mismatch it drops every
4653
// watermark so the next sync silently re-parses all jsonl from scratch
4754
// and upserts the rebuilt rollups (`replace: true` is already set) — no
4855
// purge, nothing deleted. Users get the fix transparently the next time
4956
// their agent runs.
50-
export const BACKFILL_STATE_SCHEMA_VERSION = 8
57+
export const BACKFILL_STATE_SCHEMA_VERSION = 9
5158

5259
export interface BackfillIncrementalState {
5360
version: typeof BACKFILL_STATE_SCHEMA_VERSION

0 commit comments

Comments
 (0)