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

A Codex rollout file imports as a trace, beside Claude Code sessions #18360

opened this

Merged 1h 44m ago, live in production

A Codex rollout now imports through POST /api/v1/traces/import the same way a Claude Code session does (#18358). The tests I ran pass (test/traces-import.test.ts, test/trace.test.ts, and the dead-code and duplicate-import checks), tsc --noEmit is clean, and gate --fix leaves nothing uncommitted.

Notes

opened this

A Codex rollout now imports through POST /api/v1/traces/import the same way a Claude Code session does (#18358). The tests I ran pass (test/traces-import.test.ts, test/trace.test.ts, and the dead-code and duplicate-import checks), tsc --noEmit is clean, and gate --fix leaves nothing uncommitted. I did not run the full suite, and design-lint wasn't needed because nothing under src/web/ changed.

  • Adapter: the new src/trace/import_codex.ts is an ImportAdapter over the existing parseCodexSession reader. It is added to ADAPTERS ahead of claudeCode, and nothing in the Claude Code path changed.
  • Not-my-format refusals: a refusal that only means "not my format" now carries foreign: true. importSession (src/trace/import.ts) then tries the next adapter, and any other refusal is returned as it is. Without this, Claude Code's generic message would overwrite the Codex one on a bad rollout.
  • No usable session id: a rollout whose session_meta has no usable id is refused with a 422 that names session_meta. I did not derive an id, because a resend has to find the same row. This differs from the issue's suggestion to derive one and say so.
  • One sniff: the check on a file's first records is now isCodexFile in codex.ts. parseSession and the new adapter both use it, which cleared the gate's duplicate warning.
  • Unchanged limits: the 32 MiB cap, the quota, 201 on a first send and 200 on a resend all come from the existing route.
  • Test: a new case in test/traces-import.test.ts covers four things. A first Codex send is 201, and a resend is 200 with one row. A rollout with no id is 422. A Claude Code file still imports.
  • Docs: docs/features/traces.md now gives the Codex curl line and no longer says "Not yet: Codex files".
  • Door rule: the commit says No door: because only the existing route and its how-to changed.

I first pushed before the fix commit, so there are two commits on the branch. The second names #18358, which the gate required.

To try it, run curl -X POST -H "authorization: Bearer $FORGE_TOKEN" --data-binary @"$(ls -t ~/.codex/sessions////rollout-.jsonl | head -1)" "$FORGE_URL/api/v1/traces/import", then GET /api/v1/traces?kind=imported.

🤖 Generated with Claude Code

Closes #18358

commented

A Codex rollout now imports through POST /api/v1/traces/import the same way a Claude Code session does (#18358). The tests I ran pass (test/traces-import.test.ts, test/trace.test.ts, and the dead-code and duplicate-import checks), tsc --noEmit is clean, and gate --fix leaves nothing uncommitted. I did not run the full suite, and design-lint wasn't needed because nothing under src/web/ changed.

  • Adapter: the new src/trace/import_codex.ts is an ImportAdapter over the existing parseCodexSession reader. It is added to ADAPTERS ahead of claudeCode, and nothing in the Claude Code path changed.
  • Not-my-format refusals: a refusal that only means "not my format" now carries foreign: true. importSession (src/trace/import.ts) then tries the next adapter, and any other refusal is returned as it is. Without this, Claude Code's generic message would overwrite the Codex one on a bad rollout.
  • No usable session id: a rollout whose session_meta has no usable id is refused with a 422 that names session_meta. I did not derive an id, because a resend has to find the same row. This differs from the issue's suggestion to derive one and say so.
  • One sniff: the check on a file's first records is now isCodexFile in codex.ts. parseSession and the new adapter both use it, which cleared the gate's duplicate warning.
  • Unchanged limits: the 32 MiB cap, the quota, 201 on a first send and 200 on a resend all come from the existing route.
  • Test: a new case in test/traces-import.test.ts covers four things. A first Codex send is 201, and a resend is 200 with one row. A rollout with no id is 422. A Claude Code file still imports.
  • Docs: docs/features/traces.md now gives the Codex curl line and no longer says "Not yet: Codex files".
  • Door rule: the commit says No door: because only the existing route and its how-to changed.

I first pushed before the fix commit, so there are two commits on the branch. The second names #18358, which the gate required.

To try it, run curl -X POST -H "authorization: Bearer $FORGE_TOKEN" --data-binary @"$(ls -t ~/.codex/sessions////rollout-.jsonl | head -1)" "$FORGE_URL/api/v1/traces/import", then GET /api/v1/traces?kind=imported.

🤖 Generated with Claude Code

Sign in to join this conversation.

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

Keyboard shortcuts

Docs