feat(webui): add the per-run task detail page

A per-task page at #/tasks/{id} with tabs for the attempt's stages and log, changed
files, configuration and a raw debug view. Reachable from the task list, deep
linkable via ?tab= and ?attempt=, and reload safe. Existing URLs (#/tasks?task=N
and #/tasks?status=...) are unchanged.

- A stage rail per attempt: name, duration, terminal status and error text, with
  unattributed events surfaced and the agent's own verdict shown separately.
- No pass/fail badge and no exit code anywhere: the backend has neither, and a stage
  that returned nil after producing a poor diff is a success. Status word, duration
  and error text are shown instead.
- The log pane filters by attempt, stage and level, states the coverage caveat for
  stage filters (agent and tool output records no stage), and keeps the three read
  outcomes distinct: no log reader in this deployment, no file for this attempt, and
  no entries matching the filter.
- Retry is labelled as a new run and its confirm says the previous attempt's commits
  are discarded, because it hard-resets the branch onto the base.
- An absent capture reads "not captured for this run" rather than implying nothing
  changed, and no elapsed-run figure is shown since only per-stage durations exist.
- The events cache is invalidated on retry (it previously kept the ended attempt's
  events) and the log cache is keyed by attempt, so two attempts cannot be conflated.
- ui/dist is rebuilt and committed: the gate runs the node tests but never rebuilds
  the bundle, so a stale one would otherwise ship behind a green gate.
- docs/prds/task-run-detail.md records the surface and its limits, and
  docs/architecture/observability.md describes it alongside the read endpoints.

Both new vocabularies are pinned by tests on each side (config schema, change
statuses) so a one-sided rename fails a test instead of silently degrading the page.
This commit is contained in:
sam committed 2026-09-18 18:33:03 +10:00
1 parent 862ac46e8b
commit 7414713d61
33 files changed
+4195 -91

No files matched your search

+25
View File
@@ -44,6 +44,9 @@ const READS = [
["tasks", []],
["taskMeta", []],
["task", [1]],
["taskAttempts", [1]],
["taskChanges", [1, { attempt: 2 }]],
["taskDebug", [1, { attempt: 2 }]],
["setup", []],
["capabilities", []],
["workflows", []],
@@ -191,6 +194,28 @@ test("a 415 keeps the server's explanation and reads as refused", async () => {
);
});
// The run detail page's reads. `qs` drops empty values, so an attempt the page
// has not resolved yet must not be sent as an empty string: the server treats an
// absent attempt as "the task's current attempt", and `attempt=` would be a
// different, malformed request.
test("the run detail reads build their URLs with absent filters absent", async () => {
stubFetch(okResponse);
await api.taskAttempts(42);
await api.taskChanges(42, { attempt: 2 });
await api.taskDebug(42, { attempt: 0 });
await api.taskChanges(42, {});
assert.deepEqual(
calls.map((call) => call.path),
[
"/api/tasks/42/attempts",
"/api/tasks/42/changes?attempt=2",
"/api/tasks/42/debug?attempt=0",
"/api/tasks/42/changes",
],
);
});
test("every api method is classified by this suite", () => {
const classified = new Set([
...MUTATIONS.map(([name]) => name),