Public: anyone can read this; the crew can change it.
Traces 1c: GET /api/v1/traces/:id returns the thread, turns and steps as one tree #18128
Merged 7h 20m ago, live in production
GET /api/v1/traces/:id now returns a trace as one tree: the thread's figures, then its turns, then each turn's steps. It is pushed, bun x tsc --noEmit is clean, and the gate passes. I did not run the whole suite.
-
Reviews
ApprovedClean. The route checks the scope and then the same per-row visibility rule the list uses (run log readability, a Talk turn to its person). The id is validated against a strict pattern, so a hidden, unknown or malformed id all give the identical 404. SQL is bound, the response is private/no-store, and the log is read capped at its last 512 KB. truncated covers both a cut start and the MAX_STEPS cap. The contract entry, docs/features/traces.md how-to and tests (tree vs list, Talk ownership, identical 404s, 401, truncation, speed) are in. A Talk turn's log is a run log, so parseSession is not needed.
-
Checks
shipped production is serving it deploy a338207
-
History
- Traces 1c: name /api/v1/traces/:id among the routes the floor seed cannot fill 7719170
- Traces 1c: list /api/v1/traces/:id as a route no page-budget fixture fills 50c04c3
- Traces 1c: GET /api/v1/traces/:id returns the thread, turns and steps as one tree (#18022) e75fe77
- Apps without a login 1: a sentence becomes an app in the tab forge, with no model (#18080) 4aa5b50
- A git CDN: a repository's packs served from object storage by short-lived links (#18066) 78329a7
- Access 4a: one read-only view over every grant table, and a gate test that none is missing (#18118) 11a1727
- Traces 1b: GET /api/v1/traces lists traces newest first, gated as the run's log is (#18077) 5467059
- An outside runner (a Mac) registers, claims a repository's labelled checks, and reports them as the pull's real check (#18073) 1041b3a
- Access 1: one Principal for who is asking, an anonymous visitor included (#18060) c347b92
- Apps without a login 3: an app made on one device opens on another, as a file or a read-only link (#18079) 868ed93
- API routes the Apple app lacks: the arcade's games, an app's log, pausing a runner (#18075) cd50587
- Full suite red: test/talk-preview-frame.test.ts (#18098) 78d5a5f
- Post-quantum: the game agent's channel uses a hybrid key exchange (#18074) 2df3631
- Trace index backfill stands aside when the database is locked (the hold on v0.7.729) (#18082) 52a26e1
- Every new TLS socket must check the peer's certificate (a lint) (#18063) c09e592
- Post-quantum: one test proves every door negotiates a hybrid key exchange (#18064) f0fb2b5
- Post-quantum signatures and host keys: track ML-DSA, nothing to build yet (#18078) c265edf
- Sentinel: Crew runs in trevato/deal-clock keep failing at the push or the sandbox (#18076) a98d939
- Sentinel: shared:01m23vygyffx5hg2f5vm8r74sr:sh74wg48ib is past its budget: trevato/forge: "on production's size > a cold /map answers within a few passes over the runs" failed on 3 pulls in the … (#18070) c5a926e
- Traces 2: /traces lists every trace with facets and search (#18015) 1c60934
2 earlier comments
GET /api/v1/traces/:id now returns a trace as one tree: the thread's figures, then its turns, then each turn's steps. It is pushed, bun x tsc --noEmit is clean, and the gate passes. I did not run the whole suite.
What changed
- Route:
readTraceTreeinsrc/http/api/traces.tsrebuilds the tree from the raw log withparseRunLog. A Talk turn's log is a run log, so both kinds take that one path andparseSessionisn't needed. - Thread figures: model, account, tokens in/cached/out, cost, outcome, start and end come from the index row that
GET /api/v1/traceslists, so the two answers agree. I addedgetTraceRowtosrc/trace/index_table.tsfor that. - Steps: each has kind, name, line, start and end in ms, model, tokens and outcome. A run log holds no tokens per step, so those are 0.
- Truncation:
truncatedis true when the log's start was cut (it is read from its last 512 KB) or it holds more thanMAX_STEPS(20,000) steps.timedis false when the log kept no times. - Hidden vs unknown: a hidden id (a run whose log the caller can't read, someone else's Talk turn) and an unknown or malformed id both answer the same 404
not_found. - Contract and docs:
getApiV1TracesIdis inopenapi.json, the generated lists are regenerated, anddocs/features/traces.mdhas the how-to.
Tests (test/traces-api.test.ts, passing)
- A run's tree has the same step count, errors, tokens and cost as the list row.
- A Talk turn's tree is its log's, and only its person can read it.
- A hidden id, another person's run and an unknown id give identical 404 responses, and no token gives 401.
- A cut log reports
truncated, and a 5,000-step run answers within the 100 ms budget.
I also ran the openapi, contract, doorless and boot-lazy tests; they pass.
What I left out
- No paging of steps: the tree is answered whole. Server time is about 13 ms for 5,000 steps, and the 20,000-step cap bounds the largest answer.
- The speed test uses server-reported time: the test client shares one event loop with the server, so wall time added about 100 ms of lag. It reads the
appduration fromServer-Timinginstead. - Cost not gated by owner: cost is shown as the list shows it, not restricted to people who can see the owner's facts as the run page does. The list already exposes it to the same readers.
- No new terminal screen: the commit says
No door:, because the terminal already reads a run's trace throughtraceRows. - No Codex or Claude Code import: those sessions aren't in the index yet, so this route doesn't serve them.
Try it: GET /api/v1/traces on the preview with a bearer token, then GET /api/v1/traces/<id> of an item it lists.
🤖 Generated with Claude Code
GET /api/v1/traces/:id now returns the thread, turns and steps as one tree. This push fixes the failing check on pull #18128.
Cause: pages-budget requires every route with a :param that no fixture can fill to have a file under test/budgets/unfixtured/. The new /api/v1/traces/:id route had none, so the test failed.
Fix: I added test/budgets/unfixtured/api-v1-traces-id.json, saying that no fixture holds a trace id.
Checks: test/pages-budget.test.ts and test/page-budget-files.test.ts pass locally (10 tests). I did not run bun x tsc --noEmit or the rest of the suite; the forge runs the full check on this push.
Left out: I did not add a page-budget fixture for a trace id. The route is now listed as unfixtured, as other :id API routes are.
GET /api/v1/traces/:id returns a trace's thread, turns and steps as one tree. This push fixes one of the six failures from the last check. I haven't touched the other five.
Fixed: "the patterns the seed cannot fill are exactly the ones named" failed because /api/v1/traces/:id was missing from the list of unfillable routes in test/security-floor-routes.test.ts. I added it there, saying the seed holds no trace id. That file now passes (17 tests).
Not fixed: the chaos "fill the temp disk" invariant, the two apps-rollout tests and the two changelog-regrouping tests.
- None of them touches traces code.
- I did not run them locally.
- I suspect the chaos and rollout ones depend on disk or timing, but that is a guess.
- If they fail again on the next check, send me the log and I'll look at them.
Left out: a seed fixture for a trace id. The route stays listed as unfillable, as the other :id API routes are.
GET /api/v1/traces/:idnow returns a trace as one tree: the thread's figures, then its turns, then each turn's steps. It is pushed,bun x tsc --noEmitis clean, and the gate passes. I did not run the whole suite.What changed
readTraceTreeinsrc/http/api/traces.tsrebuilds the tree from the raw log withparseRunLog. A Talk turn's log is a run log, so both kinds take that one path andparseSessionisn't needed.GET /api/v1/traceslists, so the two answers agree. I addedgetTraceRowtosrc/trace/index_table.tsfor that.truncatedis true when the log's start was cut (it is read from its last 512 KB) or it holds more thanMAX_STEPS(20,000) steps.timedis false when the log kept no times.not_found.getApiV1TracesIdis inopenapi.json, the generated lists are regenerated, anddocs/features/traces.mdhas the how-to.Tests (
test/traces-api.test.ts, passing)truncated, and a 5,000-step run answers within the 100 ms budget.I also ran the openapi, contract, doorless and boot-lazy tests; they pass.
What I left out
appduration fromServer-Timinginstead.No door:, because the terminal already reads a run's trace throughtraceRows.Try it:
GET /api/v1/traceson the preview with a bearer token, thenGET /api/v1/traces/<id>of an item it lists.🤖 Generated with Claude Code
Closes #18022