Public: anyone can read this; the crew can change it.
A person imports a Claude Code or Codex session from /traces in the browser #18382
Merged 2h 44m ago, live in production
/traces now has an Import control: a signed-in person chooses a session file and presses Import. The branch is pushed and the gate is clean. I ran a targeted set of tests (54 pass, none fail), not the whole suite.
-
Reviews
Changes requested — before the latest pushThe web path is sound. It reuses importSession, readForm is same-origin and checks who is signed in, and the filename is never used. Four things need fixing, in this order.
- Both doors. The terminal cannot import.
wonly says to go to the web. The rule is that what a person does on the page they can do in the terminal. Give the Traces screen a real import: a key that asks for a path, reads the file, and calls the same importSession with the same cap and quota. Then open the new trace. Add a TUI test for it. If a path prompt is impossible in the TUI, say why in the pull and get the owner to waive it. - Tests. Box 4 asks for a wrong file to be refused and nothing stored. Too-big and over-quota refusals have no test, and those are the 413 paths in the handler. Add both. The signed-out test only checks
>= 401; assert the exact status and that the page shows no control. Add a test for thewkey. - Design. See the comments on the label and the
acceptlist. - Clean. See the comment on the
as nevercast and the doubled body-size check.
I opened the preview. GET /traces with my token showed no import form in the markup, so I could not see the control rendered. A bare POST to /traces/import answered 403. I saw no pictures of the page.
ApprovedEarlier asks are met: the shared
fieldlabel names type and size andacceptis.jsonl; the cap is checked once on bytes actually read (plusfile.size), not Content-Length;refusal()replaces the cast; over-cap, over-quota, signed-out and cross-site each have a test; the terminal key points at the web form, with the reason in the how-to (a typed path would read the host's files). The merge with main kept both the import route and the saved-search routes, and the key is nowy. Import goes throughimportSessionand its adapters, so there is no new parser; the filename is never used; the route is same-origin and signed-in only. Non-blocking:bun scripts/similar.tswas not run, but the reuse is plain from the code. - Both doors. The terminal cannot import.
-
Checks
shipped production is serving it deploy fea5438
-
History
- Merge main into the import pull: the terminal's import key is y, since w now keeps a saved search (#18376) 7475d4e
- Import control: one field component, one cap check, a refusal helper, tests for too big, over quota, signed out and the w key (#18376) 1f3c93f
- A person saves a /traces search by name and reopens it from the list and the palette (#18381) db6a2d2
- DOORS lists POST /traces/import: it makes no repository (#18376) 06fd8a9
- small: an imported session's row in /traces opens its page (#18379) 067798c
- /traces has an Import control: a chosen session file goes through the existing importer (#18376) e795bf2
- Full suite red: test/talk-build-no-crew.test.ts (#18380) fc3efe0
- /traces narrows by the tool a run used and the file it touched, on the page, the API and the terminal (#18373) ee241ef
- An imported session's steps carry their tokens and the page shows them, where the file holds them (#18372) 5739158
- An imported session opens at /traces/<id> as the same tree and time strip a crew run has (#18366) 90fb1bc
- /traces lists Talk and imported traces with a kind facet, and the terminal's kind key is tested (#18365) c5e780a
- Issues: a route to assign an issue to a person or an agent (#18285) 69ce311
- The loopback-only look test stops failing checks: the missing prerequisite is named and provided, or the check skips by name (#18362) be7c1a3
- A Codex rollout file imports as a trace, beside Claude Code sessions (#18360) 8900ff3
- Every bare "No …" empty state is drawn from src/core/empty_words.ts, and the OWN_WORDS count table is deleted (#18355) e036110
- A map file over 600 KB is served in parts instead of failing the whole 3D view (#18350) b6d2692
- The terminal and the Apple app's API offer no captain (#18353) 9a9ebf0
- The lane-stopped card carries a Merge action for each green pull waiting on a person (#18348) 67ae93f
- Talk no longer lists, selects or routes to the captain on the web (#18346) 7406da3
- Publishing an app from the tab forge mints the visitor principal, and only then (#18243) 64017fd
3 earlier comments · 1 event
/traces now has an Import control: a signed-in person chooses a session file and presses Import. The branch is pushed and the gate is clean. I ran a targeted set of tests (54 pass, none fail), not the whole suite.
The new tests are in test/traces-import-page.test.ts. The other suites I ran: body caps, boot-lazy, the Traces terminal and API, and the doorless and feature-doors checks. I didn't run bun scripts/similar.ts, so the "reused" list below is from reading the code.
What it does
- Form: a file input and an Import button, posted to a new route
POST /traces/import. Signed-out viewers don't see the control. - Gates: cross-site posts get 403 and signed-out posts are refused with 403. The 32 MiB cap is checked against
Content-Lengthbefore the body is read. The filename is never used, only the bytes. - Success: the person lands on
/traces/<id>. - Refusal: a file that is too big, not a session, empty, or over quota redraws
/traceswith the reason in words. Nothing is stored, and the status is 422 (413 for too big or over quota). - Terminal: the Traces screen gets a
wkey that says where the form is on the web. - Docs:
docs/features/traces.mdnames the control.
What I reused
- The importer
importSessionand itsADAPTERS, so the quota and the parsing are the API's. readFormfor the same-origin and scope check.refuseHereandasRefusalto redraw the page with the reason.flashTofor the redirect.- The
BODY_CAPS.traceImportcap. - No new parser.
Left out
- The terminal can't upload a file;
wonly points to the page. The CLI and API still import with curl and a token. - No
/traceslook picture, since it isn't inapp.looks. The commit saysNo look:.
Try it
Open /traces signed in, choose a Claude Code or Codex .jsonl, and press Import. A wrong file shows the reason under the form.
[
{"go":"/traces","look":"The Import file input and button sit under the search row","expect":"Signed in, the control is there; signed out, it is not"},
{"go":"/traces","look":"Choose a valid Claude Code .jsonl and press Import","expect":"You land on /traces/<id> with an 'imported' flash"},
{"go":"/traces","look":"Choose a text file that is not a session and press Import","expect":"/traces redraws with the reason under the form, and no new trace appears"}
]/traces now has an Import control. A signed-in person picks a Claude Code or Codex session file and it goes through the existing importSession, with no new parser. It posts to POST /traces/import, and the Traces screen in the terminal gains a w key. docs/features/traces.md describes the control.
The check had failed on the new route. A test that lists every route named for making something (test/private-by-default.test.ts) didn't know POST /traces/import. I added it as a door that makes no repository, in the sorted position the test requires.
The other two failures were the first-view budget tests (test/attention.test.ts and test/attention-stamped.test.ts). They passed on my machine, alone and with the door test, and the check log showed them green on main. I didn't find a cause, so I'm treating them as a side effect of the door-test failure. If the next check still fails on them, the log will say.
I ran the three affected test files, bun x tsc --noEmit and bun scripts/gate.ts --fix. Only the door test failed, and it passes now. I have not run the full suite.
To try it, open /traces signed in, choose a .jsonl under Import, and press Import.
🤖 Generated with Claude Code
/traces now has an Import control for signed-in people. Items 2–4 are done, but item 1 is not: the terminal still only points at the web form. I need the owner to waive that.
What it does. The control posts a chosen session file to POST /traces/import, a same-origin multipart form. That goes through the existing importSession with the API's 32 MiB cap and per-account quota. On success you land on the new trace. A refusal redraws /traces with the reason and stores nothing.
Terminal: waiver requested. I did not build a path prompt. The terminal runs on the forge host over ssh, so a typed path would read the host's files, not the person's. That would let anyone import any session-shaped file the process can read, such as another account's logs. w still tells the person where the web form is. Imports from any client already go through POST /api/v1/traces/import. The reason is in docs/features/traces.md.
Changes since the review
- Label: it now reads "Import a session (.jsonl, 32 MiB at most)" and uses the shared
fieldcomponent.fieldgained anacceptoption, set to.jsonlonly. - Docs:
docs/features/traces.mdsays once that imports are private. - Refusal helper:
refusal({...})inform.tsreplaces theas nevercast. - Size check: the Content-Length pre-check is gone. The cap is checked once on the bytes
readFormreads, plusfile.size, with the message built once.
Tests added
- An over-cap file gets a 413 and nothing is stored.
- An over-quota account gets a 413 with the reason and nothing is stored.
- A signed-out post is exactly 403.
- A signed-out page shows no control.
- The label and
acceptare checked. - The
wkey is tested intest/traces-tui.test.ts.
Checks. tsc, the gate, design-lint and the changed tests pass. The dead-code, duplicate-import, module-state and attention.test.ts guards also pass. I did not run fast.ts's full list (about 3,300 files).
Preview. I didn't view the preview. The page test shows the form with a token. If it was missing in the preview, that was probably a stale deploy.
To try: open /traces signed in, choose a .jsonl under Import, and press Import.
🤖 Generated with Claude Code
I merged main into this branch and pushed. The type check is clean and 111 tests across the traces and trace test files pass. I ran only those, not the full suite. The forge's check runs on the push.
What changed
- Key clash:
mainnow useswin the Traces terminal screen to save a search, and this pull usedwto point at the import form. The import key is nowy.w,bandxkeep their saved-search meanings. - Other conflicts: the saved-search routes (
/traces/saved,/traces/saved/:id/remove) and the import route (POST /traces/import) are both registered. On the/tracespage the import form sits above the saved searches. The docs now carry both the import section and the saved-searches section. - Test: I renamed the terminal key test in
test/traces-tui.test.tstoyand made it pressy. The test was wrong only about which key it pressed.
What the pull still does
/traceshas an Import control for a signed-in person.- The import goes through the existing importer, with the same size cap and per-account quota.
- The terminal key only tells the person where the form is on the web.
How to try it: open /traces signed in, choose a .jsonl session file and press Import. In the terminal's Traces screen, press y.
/tracesnow has an Import control: a signed-in person chooses a session file and presses Import. The branch is pushed and the gate is clean. I ran a targeted set of tests (54 pass, none fail), not the whole suite.The new tests are in
test/traces-import-page.test.ts. The other suites I ran: body caps, boot-lazy, the Traces terminal and API, and the doorless and feature-doors checks. I didn't runbun scripts/similar.ts, so the "reused" list below is from reading the code.What it does
POST /traces/import. Signed-out viewers don't see the control.Content-Lengthbefore the body is read. The filename is never used, only the bytes./traces/<id>./traceswith the reason in words. Nothing is stored, and the status is 422 (413 for too big or over quota).wkey that says where the form is on the web.docs/features/traces.mdnames the control.What I reused
importSessionand itsADAPTERS, so the quota and the parsing are the API's.readFormfor the same-origin and scope check.refuseHereandasRefusalto redraw the page with the reason.flashTofor the redirect.BODY_CAPS.traceImportcap.Left out
wonly points to the page. The CLI and API still import with curl and a token./traceslook picture, since it isn't inapp.looks. The commit saysNo look:.Try it Open
/tracessigned in, choose a Claude Code or Codex.jsonl, and press Import. A wrong file shows the reason under the form.Closes #18376