Public: anyone can read this; the crew can change it.
Traces: every conversation and run kept as a trace, imported from outside agents, and explored in the forge #17968
Merged 14h 53m ago, live in production
forge trace now reads Codex rollout files as well as Claude Code sessions. This closes only the "Codex" half of the Import item in #17929. Everything else on that issue is still open, and I did not try to fit it into one run.
-
Reviews
ApprovedA small, correct slice:
forge traceand--otlpnow read a Codex rollout as well as a Claude Code session. The format is sniffed from the first record insrc/trace/session.ts. Bad lines and oversize lines are counted as skipped. The reader takes no network input, runs no shell and writes no state. Both new behaviours (sniffing and token attribution) have tests that would fail without them. The terminal door and the docs (docs/features/traces.md,docs/CLI.md) match the change, and README is untouched. No page, action or API route changes, so there is nothing for me to check in the preview. This is a slice of #17929: the issue's boxes need storage, a list, a trace page, compare and share, and none of those exist yet, so I tick none of the eight.Two things to do next:
- Store an import: a
POSTthat keeps the raw bytes and rebuilds the normalized view from them (box 2). It should be private to the importer by default, check who is calling, and cap the body by the bytes actually read. ReuseparseSession. - Fold the duplicated
turnAtincodex.tsandclaude_code.tsinto one helper inmodel.ts, and remove the stray double blank line indocs/features/traces.mdbefore the Modules line.
- Store an import: a
-
Checks
shipped production is serving it deploy a338207
-
History
- Merge main into scout/17929-traces-every-conversation-and-run-kept-a f366d98
- Traces 3: one trace as a tree beside a time strip, with what it changed (#17996) 2902a64
- Merge pull request #17997 from sold/ssh-mlkem 05c87e1
- SSH: the hybrid's K has its own known answer, the client test skips the hybrid on OpenSSH before 9.9, one comment, the docs in their own paragraph 281e40c
- Merge pull request #17998 from sold/tab-start 7e39794
- The /tab fix serves #16840 4eed511
- /tab starts in Safari and Chrome: the worker sees its host page, and the page waits for activation a5d9dd7
- SSH offers the hybrid post-quantum key exchange first: mlkem768x25519-sha256 1124a92
- The api-* test files read no answer that disagrees with openapi.json (#17990) 2d01f4a
- The suite's fetch reports each /api/v1 answer that disagrees with openapi.json, without failing yet (#17989) 3a1266c
- Anonymous, opt-in app telemetry: a route to receive daily summaries, and an owner view (#17967) 973052e
- Runner jobs' git-upload-pack: count the work per job, then cut it so the serving thread is not held (#17984) ee5308f
- A `[loop]` stall line names what the serving thread was doing: the route or duty in flight (#17982) bb47d9a
- takeLook's loopback-only test stops failing checks for a missing prerequisite (56 reds last week) (#17979) 87f7f1b
- A Talk turn that reaches its limit says so and offers one tap to go on (#17981) 7ada34c
- Talk logs one line per model call: account, model, seconds, how it ended (#17980) 353f588
- Sentinel: The lane has stopped: nothing has merged and nothing said so (#17973) 010904c
- Full suite red: test/traffic-truth.test.ts (#17972) 13460d3
- Rewrap comments 6e7fcac
- Traces: forge trace reads a Codex rollout as well as a Claude Code session (#17929) 6e785aa
3 earlier comments · 1 event
forge trace now reads Codex rollout files as well as Claude Code sessions. This closes only the "Codex" half of the Import item in #17929. Everything else on that issue is still open, and I did not try to fit it into one run.
What changed
src/trace/codex.tsreads a rollout (session_meta,turn_context,response_item,event_msg) into the existing turns-and-steps shape.- Codex's startup environment messages are not counted as prompts.
- A reply takes the token count that follows it.
- A tool call's outcome comes from the
exit_codein its output. - Lines that aren't records are counted as skipped, and an oversize line is skipped.
src/trace/session.tspicks the reader from the first record.forge trace <file>and--otlpboth go through it.- The trace source is now
"claude-code" | "codex". The OTLP export names the agent and the provider (openaifor Codex,anthropicfor Claude Code) from it. docs/features/traces.mdanddocs/CLI.mddescribe the new input.
Checks
test/trace.test.tshas new tests covering format detection, prompts, tool outcomes, token attribution and the OTLP provider.- The trace tests (6) pass.
tsc --noEmitis clean.- The CLI-docs, feature-doors, front-matter, dead-code and unused-exports tests I ran pass.
- The gate's duplicate-function note about
turnAtincodex.tsandclaude_code.tsis still there. It is a note and does not fail the check.
Not done
- Storing an import: there is still no
POST, no archive and no database. - The list with facets, the trace page with its time strip, what a run changed, compare, permalinks and share links.
- Cost: neither format records one.
- The terminal is the only door, so there is no page, API route or
src/tui/screen to match. The change touches no web page, action or API route, so the both-doors rule does not apply.
Try it: forge trace ~/.codex/sessions/<day>/rollout-<id>.jsonl, then add --otlp.
🤖 Generated with Claude Code
The Codex reader from my earlier push is the only change on this branch. The split into #17991–#17995 leaves nothing more for this issue, so I made no new commits.
What the branch holds
forge trace <file>reads a Codex rollout as well as a Claude Code session, with the format sniffed from the first record (src/trace/codex.ts,src/trace/session.ts).- The OTLP export names the provider from the source.
- The change is terminal-only and touches no page, action or API route, so the both-doors rule does not apply. It adds no module-level state, and the dead-code and unused-exports tests pass.
test/trace.test.tscovers the Codex reader and the OTLP provider.
For the children
- #17994 (import a Claude Code session) can reuse
parseSessionfromsrc/trace/session.tsfor the Codex half. It needs no new reader. - The
StepandTracetypes insrc/trace/model.tsare the shape #17991 can build the stored record on. - The forge's own conversations and runs have no reader yet, so #17991 needs one.
This issue stays open as the parent until those land.
🤖 Generated with Claude Code
I merged main into this branch and pushed it. The only conflict was docs/features/traces.md.
In that file I kept main's new "One run as a tree (#17993)" section whole. I kept this pull's Codex reader in the modules line (src/trace/codex.ts and src/trace/session.ts). I removed "Codex files" from the "Not yet" list, since the reader now exists. I also moved "tokens and cost per step" into that list from main's version.
bun x tsc --noEmit printed nothing. The two trace test files pass (17 tests). I did not run the full suite; the forge runs it on the push.
Left #17929 open: 8 unticked items remain (Every Talk conversation, every crew run's log and every review is a trace, kept forever. The raw bytes are the record, and a normalized view is rebuilt from them: thread → turns → steps (model call, tool call, subagent), each with times, model, account, tokens in, cached and out, cost, and outcome.; Import: POST a session file from an outside agent (Claude Code's session JSONL first, then Codex), so the owner's own sessions from his Mac and phone join the same archive, attributed and private by default.; One list of every trace, with facets: repository, app, file touched, tool, model or account, outcome, cost, date, person or agent. Saved searches. Full-text over titles and summaries, and over archived turns when asked.; …).
forge tracenow reads Codex rollout files as well as Claude Code sessions. This closes only the "Codex" half of the Import item in #17929. Everything else on that issue is still open, and I did not try to fit it into one run.What changed
src/trace/codex.tsreads a rollout (session_meta,turn_context,response_item,event_msg) into the existing turns-and-steps shape.exit_codein its output.src/trace/session.tspicks the reader from the first record.forge trace <file>and--otlpboth go through it."claude-code" | "codex". The OTLP export names the agent and the provider (openaifor Codex,anthropicfor Claude Code) from it.docs/features/traces.mdanddocs/CLI.mddescribe the new input.Checks
test/trace.test.tshas new tests covering format detection, prompts, tool outcomes, token attribution and the OTLP provider.tsc --noEmitis clean.turnAtincodex.tsandclaude_code.tsis still there. It is a note and does not fail the check.Not done
POST, no archive and no database.src/tui/screen to match. The change touches no web page, action or API route, so the both-doors rule does not apply.Try it:
forge trace ~/.codex/sessions/<day>/rollout-<id>.jsonl, then add--otlp.🤖 Generated with Claude Code
Closes #17929