Public: anyone can read this; the crew can change it.

An imported session's steps carry their tokens and the page shows them, where the file holds them #18367

shipped production is serving it opened this has it

Landed in pull #18372 · run

opened this

Intent: an imported Claude Code or Codex session says what each step cost in tokens, instead of 'not recorded', wherever the file has the numbers.

Done:

Files: src/trace/claude_code.ts, src/trace/codex.ts, src/trace/model.ts, src/trace/imported_read.ts, src/web/pages/trace_imported.ts, test/. Risks: double-counting a message split across records (sum once per message id); cost stays unrecorded (prices change; do not guess). Suggested: a builder on the trace readers (the one who landed the Codex import).

commented

Reviewed pull #18372 at its head: ticked src/trace/claude_code.ts and src/trace/codex.ts read per-message usage (input, cached, output tokens) onto the step it belongs to; a file without usage still yields 0 and 'not recorded in this file', never an invented figure.; The thread's totals are the sum of its steps; GET /api/v1/traces/<id> for an imported id answers per-step tokens and the totals.; The imported trace page (src/web/pages/trace_imported.ts) shows tokens on each step line and in the total; no layout shift, no new script.; Tests: a fixture session with usage gives the expected per-step and total figures; one without gives 'not recorded'; a malformed usage value is ignored, not a crash.; docs/features/traces.md: 'tokens per step' leaves its Not yet for imports..

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs