Public: anyone can read this; the crew can change it.
Traces 4: a Claude Code session file imports as a trace and is listed beside the others #18071
Reviewed pull #18129 at its head: ticked POST /api/v1/traces/import takes a Claude Code session JSONL. The body is streamed and size-capped, with a plain 413 past the cap, and the raw file is stored compressed under FORGE data. It is attributed to the caller, private to them by default, and of kind imported. It is in openapi.json, contract-tested, and checks the same origin for a session caller.; Its row is written to trace_index, so GET /api/v1/traces?kind=imported lists it for the caller and not for another account.; The adapter sits behind a small interface, one file per source, so Codex (src/trace/codex.ts) is the next adapter and not a rewrite.; Importing the same session twice updates one trace, keyed on the session id. It never makes a duplicate.; The docs give a one-line command to send a session from a Mac.; A test imports a recorded session fixture and reads back, through src/trace/read.ts, its turns, tool calls, tokens and model. A second import still leaves one row. An oversized or malformed file is refused with its reason..
Replaces #18014, which was handed to builders twice before the part it builds on was on main. Part of #17929 (Traces). The owner, 2026-12-03: "preserve all threads... and be able to analyze them with a fantastic interface in the forge." Nothing here deletes anything.
Start from main once #18021 (Traces 1b,
GET /api/v1/traces) has landed. On main already: thetrace_indextable (src/trace/index_table.ts, 35e4ee278), the trace model and reader (src/trace/model.ts,src/trace/read.ts) and the Claude Code reader (src/trace/claude_code.ts). Reuse that reader; do not write a second parser. There is noGET /api/v1/traces/:idroute, and this issue does not add one.Done looks like:
Files: src/trace/ (import adapter), src/http/routes (a traces import route), src/contract/openapi/, docs/, test/traces-import.test.ts. Risks: the route-timing walk. A new route runs inside a session phase; do not add an
UNTIMEDentry (that walk failed #17999 three times).