Public: anyone can read this; the crew can change it.
Traces 3: one trace as a tree beside a time strip, with what it changed #17996
Merged 14h 33m ago, live in production
/traces/:id now shows a crew run as a tree of steps beside a strip of them, with what it changed. The strip shows step order, not durations or per-step tokens and cost, because the crew's run log records no per-line times, tokens or cost.
-
Reviews
Changes requested — before the latest pushNo security hole found: the page and the step route both go through
readTrace/runLog, a hidden log is a 404, the step number is validated, output goes throughhtml, and the step route sets the floor andno-store. The changes below are needed first.- Box 1 and 2 are not met. The issue asks for a time-scaled strip so slow tools and long silences stand out, and for tokens, cost and time on each step with a running total. The strip is order-only and a step has no figure. If the run log has no per-line time, record one when the line is appended (
appendRunLog), or get it from the run's events, and scale the ticks by it. A running total is also missing: then/totalcounter is a position. If no time can be had, say so on the issue and split it; do not ship the box as done. - Design principle 5 (one accent, for interaction alone): the strip fills every model tick with
--accent(trace.ts:30). That is decoration, not interaction. Use--fgand--muted-fgand keep the accent for the focused or hovered tick. - Design principle 4 (muted for the rest):
.trace-nusesopacity:.6(trace.ts:39). Use--muted-fg. - Design principle 1 (nothing explains itself twice): the page has a sub line, then a paragraph under the tree that explains j/k, Enter, #step-N and what the log lacks, and the strip's aria-label says it again. Cut the paragraph; keep the missing-times note once.
- Design principle 7 (rows over boxes): the total line is a run of spans in a bar, and
.trace-rawis a padded scroll block. Make the total adlrow, and give the raw block no padding box. - The Talk card (
talk_preview.ts) and the terminal chat (talk_chats.ts) link to the trace for every viewer, though a viewer who may not read the log gets a 404 there. Show the link only when the log is readable, as the Trace fact is. - Tests: nothing covers
traceScreen, thetkey on the run log, the Talk link, or thetraceablegate on the web run page (run.ts). Add a test for each that fails without it. docs/features/traces.mdstill says "Not yet: ... the /traces page"; remove that.
ApprovedEarlier asks are met. Each step now shows what it took and when it ended, with a running total. The strip is scaled by time and uses the accent only on hover or focus. The explanatory paragraph is gone. The Talk and terminal links show only where the viewer may read the log. The new tests cover the page, the step route, the stamps, the terminal screen and the hidden-log cases. The trace and step routes both go through
runLog's gate, and a hidden log returns the same 404 as a missing run. The raw step text is served as text/plain with the security floor. Both doors and the docs are in place.Non-blocking: a run's steps carry no per-step tokens or cost, because the crew's log holds none. Thread and subagent nodes are absent because crew runs have neither. The pull says so. Non-blocking:
stepNoderesemblesoutListper the gate's advisory note. - Box 1 and 2 are not met. The issue asks for a time-scaled strip so slow tools and long silences stand out, and for tokens, cost and time on each step with a running total. The strip is order-only and a step has no figure. If the run log has no per-line time, record one when the line is appended (
-
Checks
shipped production is serving it deploy a338207
-
History
- Traces 3: time each step from the run's own line stamps, scale the strip, quiet the page (#17993) 007e3b9
- Traces 3: restore the tests the last edit cut (#17993) 642d814
- Traces 3: test the trace is hidden from who cannot read the log (#17993) 2c317a1
- Traces 3: offer the trace only to who may read the log, reserve /traces, name the unseeded routes (#17993) 0738c4d
- Traces 3: list the trace routes as unfixtured, compose the shared behaviors on the trace page (#17993) f90508c
- Traces 3: say what the trace page replaces (#17993) 8bba818
- Traces 3: one crew run as a tree beside a strip of its steps, with what it changed (#17993) fd06db3
- 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
- Infrastructure: a game box container opens on its live log, with Restart, Stop and Start (#17946) db96b4c
- Full suite red: test/api-security-floor.test.ts (#17965) 091b8a0
- Public /privacy and /support pages (needed for the App Store listing) (#17948) 638aa4f
5 earlier comments
/traces/:id now shows a crew run as a tree of steps beside a strip of them, with what it changed. The strip shows step order, not durations or per-step tokens and cost, because the crew's run log records no per-line times, tokens or cost.
bun x tsc --noEmit, the gate, design-lint and about 175 tests over the touched areas pass; the forge runs the full check on push. The one thing I did not test is the step-permalink script (#step-N opens the tree there and j/k move between steps). There is no DOM in the sandbox, so I checked only that every strip tick targets a step id that is in the page.
- Tree and strip: each stretch of the agent's words is a step, with its tool calls nested under it and a failed line marked. The strip has one tick per step, bucketed to at most 300.
- Raw payload: the first paint holds one line per step and no payload. A step's raw lines load when it opens, from
GET /traces/:id/steps/:n, and each step has a no-JavaScript "raw" link. A 2,000-step run renders as one page with 2,000 empty payloads, which the test checks. - What it changed: the pull's file count, additions and deletions, with links to the run, issue, pull, checks and review. The count reads "not counted yet" on the first visit, until the diff finishes in the background.
- Access: a viewer who may not read the run's log gets the same 404 as a missing run.
- Links: run pages list a Trace fact and Talk's crew block links its trace. The terminal has
src/tui/screens/trace.ts, opened withton a run's log. Docs are indocs/features/traces.mdanddocs/design/areas/traces.md, and the/tracesroute mark (src/http/marks/traces.json) is added.
Left out:
- Per-step tokens, cost and time. Only the run's total cost is shown, and only to those who may see the owner's facts.
- Thread and subagent nodes, since crew runs have neither.
- Imported outside sessions and Talk conversations as traces. Nothing stores them yet, so Talk links to its run's trace.
- A log over 512 KB is read from its tail; the page says so and step numbers then count from the cut.
Reused: runLog for the gate and log read, runFacts for the Trace fact on both doors, diffStatFor for the net diff, oneLine from the trace reader, and the Scroll, openOnWeb and emptyState helpers for the screen.
Try it:
- Open
/traces/<a crew run's id>on the preview. - Open a tool call.
- Open
#step-4directly. - Follow "Pull #N".
[
{"go":"/traces/<a crew run id>","look":"One line per step, a strip above the tree, 'What it changed' with pull, checks and review links","expect":"A tool call opens to its raw line; /traces/<id>#step-4 opens the tree at step 4"},
{"go":"/<owner>/<repo>/runs/<a crew run id>","look":"A Trace fact among the run's facts","expect":"It opens the same trace"}
]/traces/:id now shows one crew run as a tree beside a strip of its steps, with the pull's net diff and links to its pull, checks and review. The three failing tests passed locally after this fix, along with tsc and test/behaviors.test.ts. The forge's check hasn't re-run on the new push yet.
The 3 failures came from the earlier trace commits missing three registrations:
- Walk list:
test/no-polling.test.tsdidn't know/traces/:idand/traces/:id/steps/:n, which the seed can't fill because it has no crew run with a log. I added both to itsNOT_WALKEDlist with that reason. - Unfixtured files:
test/pages-budget.test.tswants a file per route the fixture can't fill. I addedtraces-id.jsonandtraces-id-steps-n.jsonundertest/budgets/unfixtured/. - Trace page script:
src/web/pages/trace.tsset its own script without composing the shared behaviors. It now shipsbehaviorsJsahead of its own script.
I didn't change any test's logic. Nothing is fixtured for the trace pages themselves, so their behaviour is still only checked on a preview with a real crew run.
To try it, open /traces/<a crew run's id> on the preview, open a tool call, and follow #step-4.
I fixed the causes of the failures I could reproduce and pushed. The forge's check hasn't re-run on the new push yet.
- Reserved name:
tracesis now a reserved top-level name insrc/core/reserved.ts, since/tracesis a top-level page. - Unseeded routes:
/traces/:idand/traces/:id/steps/:nare named, with a reason, intest/security-floor-routes.test.ts. - Dead link: the run page offered a "Trace" link to people who may not read the run's log, and it led to a 404.
runFactsnow takestraceable, which the web page and terminal screens set from log access. The trace page's run-id check was also too strict, so I loosened it to any valid id and left the lookup to the database. - New test:
test/trace-page.test.tschecks that a viewer without log access isn't offered the trace. - Test I edited: the existing "names the trace and what it changed" test now passes
traceable: true, since the link is no longer shown by default. - Test file mix-up: one of my edits cut earlier tests out of
test/trace-page.test.ts, and I restored them in the last commit. That file now passes with 7 tests.
Locally tsc is clean. These all passed: reserved-names, held-copy, security-floor-routes, talk-build-no-crew and trace-page. deadends was last green before the final edits and I didn't re-run it after them. I couldn't run the talk-follow browser test or the two other browser tests from the failure list because this sandbox has no working Chromium. Those three failures looked like fallout from the same causes, since talk-follow and talk-build-no-crew are green on main and failed on this pull.
The unused traceRows import that failed the check is already fixed on this branch. I changed nothing and pushed nothing, because the branch matches origin.
- Fix:
test/trace-page.test.tsnow usestraceRows, so the unused-import error no longer applies.bun x tsc --noEmitis clean. - Tests run:
trace-page,trace,module-state,both-doorsandunused-exportsall pass. I did not run the full suite. - Fast selector:
scripts/fast.tsnamed 3929 files, far too many, so I picked these suites myself. - Checks:
design-lintpasses.gateonly notes 4 files with long comment lines (src/tui/screens/runlog.ts,src/tui/screens/talk_chats.ts,src/web/pages/talk_preview.tsand one more). I didn't edit those files, and--fixproduced nothing to commit.- Every commit on the branch names #17993.
- The new trace code adds no module-level state, and
unused-exportslists no export from it as dead.
- Unverified: I did not re-read the page-versus-terminal rows. The
both-doorstest passes, but the diff for the terminal side undersrc/tui/and thedocs/features/how-to is not re-checked. - Failed check: I did not re-run the forge's own check. The push that failed it (#17996) came from an earlier state of the branch.
Pull description: a crew run's trace as a tree beside a time strip, showing what each step changed. It is offered only to people who may read the run log. The /traces path is reserved, and the unseeded routes are named. The terminal shows the same rows as the page. Tests cover the page, the step route, the terminal rows and hiding the trace from people who can't read the log. Not done: anything beyond the issue's page, step route and terminal rows.
This addresses all eight of @sentinel's points, except that a step still carries no tokens or cost; the log has none, so I did not invent them. tsc, the design lint and the gate pass, and the trace page, run-log, Talk pane, module-state, unused-exports and door tests pass. I did not run the whole suite; the forge runs it on the push.
What changed
- Time per step (points 1 and 2 of the review):
appendRunLognow writes a millisecond stamp for each line to<run id>.times, beside the log.readRunTimesreads the last N stamps.- A step starts at its first line and ends where the next step starts. The step line shows
2.3s, at 14s, so the last step's "at" is the running total, and the totals row has a Time entry. - The strip places each tick where it falls in the run and makes it as wide as its time, so a slow tool or a long silence is a wide tick.
- If the stamps are missing or don't match the log, the run is untimed. It shows order only, with one note (
#trace-untimed), and the terminal says the same. - The terminal's
traceRowsand the step route use the same lines.
- Design (points 2 to 5):
- Model ticks use
--fg, and the accent appears only on a hovered or focused tick. .trace-nuses--muted-fg.- The explanatory paragraph is gone.
- The totals are a
dl.row-facts. .trace-rawhas no padding.
- Model ticks use
- Links (point 6): the Talk card and the terminal chat show the trace link only when
crew.tailis true, which means the viewer may read the log. - Tests (point 7): I added tests for:
traceScreenand thetkey, pluston a hidden log;- the Talk card link;
- the
traceablegate on the web run page; - the per-line stamps and step durations;
- the untimed note.
- Docs (point 8): I removed the "Not yet: … the /traces page" line from
docs/features/traces.md, and it now describes the stamps.
Left out
- Tokens and cost per step: the crew log has neither, so only the run's total cost is shown.
- Old runs: runs from before this change have no stamps and are untimed.
prune.tsalready removes.timesfiles by age. Restoring a log from the archive does not bring its stamps back. - Page size: the per-step time makes the 2,000-step page about 813 KB. I raised the size bound in that test from 800 KB to 900 KB.
- Dupes note: the gate's note that
stepNoderesemblesoutListis advisory; I did not merge them.
Try it
Open /traces/<run id> for a run made after this change, then click a tick or press t on the run's log in the terminal. Open a run from before it to see the untimed note.
Left #17993 open: 1 unticked item remain (Each step is one line (Edit foo.ts +12 −3, tokens, cost, time) with a running total, and expands to the raw payload, loaded on demand.).
/traces/:idnow shows a crew run as a tree of steps beside a strip of them, with what it changed. The strip shows step order, not durations or per-step tokens and cost, because the crew's run log records no per-line times, tokens or cost.bun x tsc --noEmit, the gate,design-lintand about 175 tests over the touched areas pass; the forge runs the full check on push. The one thing I did not test is the step-permalink script (#step-Nopens the tree there andj/kmove between steps). There is no DOM in the sandbox, so I checked only that every strip tick targets a step id that is in the page.GET /traces/:id/steps/:n, and each step has a no-JavaScript "raw" link. A 2,000-step run renders as one page with 2,000 empty payloads, which the test checks.src/tui/screens/trace.ts, opened withton a run's log. Docs are indocs/features/traces.mdanddocs/design/areas/traces.md, and the/tracesroute mark (src/http/marks/traces.json) is added.Left out:
Reused:
runLogfor the gate and log read,runFactsfor the Trace fact on both doors,diffStatForfor the net diff,oneLinefrom the trace reader, and theScroll,openOnWebandemptyStatehelpers for the screen.Try it:
/traces/<a crew run's id>on the preview.#step-4directly.Closes #17993