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 2c09f42ff4
commit 4ab353ebdd
33 files changed
+4195 -91

No files matched your search

+19 -4
View File
@@ -6,6 +6,7 @@ import { el, mount } from "./base/dom.jsx";
import { icon } from "./base/icons.jsx";
import { dashboardPage } from "./dashboard/dashboard.jsx";
import { tasksPage } from "./tasks/tasks.jsx";
import { taskDetailPage } from "./tasks/task-detail.jsx";
import { skillsPage } from "./skills/skills.jsx";
import { workflowsPage } from "./workflows/workflows.jsx";
import { channelsPage } from "./channels/channels.jsx";
@@ -17,6 +18,7 @@ import { mappingsPage } from "./mappings/mappings.jsx";
import { bindingsPage } from "./bindings/bindings.jsx";
import { memoryPage } from "./memory/memory.jsx";
import { chatPage } from "./chat/chat.jsx";
import { matchRoute, navPath } from "./routing.jsx";
/**
* Routes are declared once here. Adding a section means adding a feature
@@ -32,10 +34,19 @@ import { chatPage } from "./chat/chat.jsx";
// daemon and the extracted UI service -- and a section the serving process
// cannot back would otherwise render as permanently empty rather than as
// absent (archie-core-8cda.5.4).
//
// A route may also carry:
// nav:false -- addressed by URL but not a navigation entry (a detail page
// reached from its section)
// navPath -- the navigation entry this route keeps current; a parameterised
// route is not itself in the nav, so without this the section it
// belongs to would lose its aria-current highlight
// :name -- one captured path segment, e.g. /tasks/:id
const routes = [
{ path: "/", label: "Dashboard", icon: "dashboard", view: dashboardPage },
{ path: "/chat", label: "Chat", icon: "chat", view: chatPage, section: "chat" },
{ path: "/tasks", label: "Tasks", icon: "tasks", view: tasksPage },
{ path: "/tasks/:id", label: "Task run", view: taskDetailPage, nav: false, navPath: "/tasks" },
{ path: "/logs", label: "Logs", icon: "logs", view: logsPage, section: "logs" },
{ path: "/captures", label: "Event inspector", icon: "captures", view: capturesPage, section: "captures" },
{ path: "/mappings", label: "Field mappings", icon: "mappings", view: mappingsPage, section: "mappings" },
@@ -66,6 +77,7 @@ function commandBar(onNavigate, onToggleChat) {
"nav.nav",
...[null].flatMap(() => [
...routes
.filter((route) => route.nav !== false)
.map((route) => {
const item = el(
"a.nav-item",
@@ -135,7 +147,7 @@ function commandBar(onNavigate, onToggleChat) {
}
if (e.key !== "Enter") return;
const q = e.target.value.trim().toLowerCase();
const hit = routes.find((r) => !r.soon && r.label.toLowerCase().startsWith(q));
const hit = routes.find((r) => r.nav !== false && !r.soon && r.label.toLowerCase().startsWith(q));
if (hit) {
onNavigate(hit.path);
e.target.value = "";
@@ -230,8 +242,11 @@ function start() {
// stream does not leak a connection per navigation.
outlet.firstElementChild?.dispatchEvent(new CustomEvent("archie:teardown"));
const [path, query = ""] = rawPath.split("?", 2);
const route = routes.find((r) => r.path === path) || routes[0];
bar.highlight(route.path);
const match = matchRoute(routes, path);
const route = match?.route || routes[0];
// A detail route highlights the section it belongs to, so the nav item for
// Tasks stays current on #/tasks/42 instead of every item losing it.
bar.highlight(navPath(route));
// The chat is a drawer, not a page: /chat opens it rather than mounting a
// second chatPage() (which would duplicate session state and the stream).
if (route.path === "/chat") {
@@ -250,7 +265,7 @@ function start() {
// mount()/replaceChildren() should not alternate on the same outlet
// across navigations, since Preact tracks its own vdom state on the
// container node; if a `soon: true` route is ever added, revisit this.
const rendered = route.view ? route.view(new URLSearchParams(query)) : comingSoon(route);
const rendered = route.view ? route.view(new URLSearchParams(query), match?.params || {}) : comingSoon(route);
if (rendered instanceof Node) {
mount(outlet, rendered);
} else {