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:
1 parent
862ac46e8b
commit
7414713d61
33 files changed
+4195
-91
No files matched your search
@@ -0,0 +1,111 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { render, cleanup } from "@testing-library/preact";
|
||||
import { AttemptConfig, CONFIG_SCHEMA, selectConfigEvent } from "../src/tasks/attempt-config.jsx";
|
||||
|
||||
const EVENTS = [
|
||||
{
|
||||
kind: "config_captured",
|
||||
attempt: 1,
|
||||
at: "2026-09-18T07:00:00.100Z",
|
||||
stage: "",
|
||||
data: { schema: CONFIG_SCHEMA, document: { BotUser: "archie-attempt-one", Models: { main: "openai/gpt" } } },
|
||||
},
|
||||
{
|
||||
kind: "config_captured",
|
||||
attempt: 2,
|
||||
at: "2026-09-18T07:05:00.100Z",
|
||||
stage: "",
|
||||
data: { schema: CONFIG_SCHEMA, document: { BotUser: "archie-attempt-two", Models: { main: "openai/gpt" } } },
|
||||
},
|
||||
];
|
||||
|
||||
function mount(props) {
|
||||
const { container, unmount } = render(<AttemptConfig {...props} />);
|
||||
return { root: container, unmount };
|
||||
}
|
||||
|
||||
// Selecting by kind alone would show the newest attempt's configuration on
|
||||
// every attempt -- the merge-attempts bug the attempt column exists to prevent.
|
||||
test("the configuration is selected by kind and attempt together", () => {
|
||||
const { root, unmount } = mount({ events: EVENTS, attempt: 1 });
|
||||
assert.match(root.textContent, /archie-attempt-one/);
|
||||
assert.doesNotMatch(root.textContent, /archie-attempt-two/);
|
||||
assert.match(root.textContent, /attempt 1's effective task-runtime configuration/);
|
||||
unmount();
|
||||
});
|
||||
|
||||
test("an attempt with no config event of its own says so, never another attempt's", () => {
|
||||
const { root, unmount } = mount({ events: EVENTS, attempt: 3 });
|
||||
assert.equal(root.querySelector(".empty-title").textContent, "Not captured for this run");
|
||||
assert.doesNotMatch(root.textContent, /archie-attempt-one|archie-attempt-two/);
|
||||
assert.match(root.textContent, /Nothing here says the run used the defaults/);
|
||||
unmount();
|
||||
});
|
||||
|
||||
test("the document is passed through verbatim, pretty-printed", () => {
|
||||
const { root, unmount } = mount({ events: EVENTS, attempt: 2 });
|
||||
const json = root.querySelector(".run-json").textContent;
|
||||
assert.match(json, /"BotUser": "archie-attempt-two"/);
|
||||
assert.match(json, /"Models"/);
|
||||
unmount();
|
||||
});
|
||||
|
||||
// The page must not imply this document is the whole configuration: it is the
|
||||
// non-secret task-runtime subset.
|
||||
test("the panel states the scope of what was captured", () => {
|
||||
const { root, unmount } = mount({ events: EVENTS, attempt: 1 });
|
||||
assert.match(root.textContent, /non-secret subset/);
|
||||
assert.match(root.textContent, /not the dashboard configuration view/);
|
||||
assert.match(root.textContent, /providers, repositories, identities, credentials and lock state/);
|
||||
unmount();
|
||||
});
|
||||
|
||||
test("an unrecognised schema is named and its payload is still shown", () => {
|
||||
const events = [
|
||||
{ kind: "config_captured", attempt: 2, at: "2026-09-18T07:05:00.100Z", data: { schema: "archie/task-config@9", document: { future: true } } },
|
||||
];
|
||||
const { root, unmount } = mount({ events, attempt: 2 });
|
||||
assert.match(root.textContent, /unknown schema \(archie\/task-config@9\)/);
|
||||
assert.match(root.querySelector(".run-json").textContent, /"future": true/);
|
||||
unmount();
|
||||
});
|
||||
|
||||
test("a config event with no data at all renders the raw payload rather than guessing", () => {
|
||||
const events = [{ kind: "config_captured", attempt: 2, at: "2026-09-18T07:05:00.100Z" }];
|
||||
const { root, unmount } = mount({ events, attempt: 2 });
|
||||
assert.match(root.textContent, /unknown schema/);
|
||||
assert.ok(root.querySelector(".run-json"));
|
||||
unmount();
|
||||
});
|
||||
|
||||
test("loading and failure states are distinct, and the failure offers a retry", () => {
|
||||
const loading = mount({ events: undefined, attempt: 1 });
|
||||
assert.match(loading.root.textContent, /Loading this task's events/);
|
||||
loading.unmount();
|
||||
|
||||
const failed = mount({ events: null, attempt: 1, onRetry: () => {} });
|
||||
assert.match(failed.root.textContent, /Could not load this task's events/);
|
||||
assert.equal(failed.root.querySelector("button").textContent, "Retry");
|
||||
failed.unmount();
|
||||
});
|
||||
|
||||
test("selectConfigEvent ignores other kinds and other attempts", () => {
|
||||
const events = [
|
||||
{ kind: "stage_finish", attempt: 2, data: {} },
|
||||
...EVENTS,
|
||||
];
|
||||
assert.equal(selectConfigEvent(events, 2).attempt, 2);
|
||||
assert.equal(selectConfigEvent(events, 3), null);
|
||||
assert.equal(selectConfigEvent(undefined, 1), null);
|
||||
});
|
||||
|
||||
// CONFIG_SCHEMA mirrors events.ConfigCapturedSchema (internal/events/events.go),
|
||||
// which the Go suite pins by the same literal. Pinning both sides is what makes
|
||||
// a one-sided rename a failing test rather than every attempt rendering as
|
||||
// "unknown schema".
|
||||
test("the config schema is the one the producer stamps", () => {
|
||||
assert.equal(CONFIG_SCHEMA, "archie/task-config@1");
|
||||
});
|
||||
|
||||
test.after(() => cleanup());
|
||||
Reference in new issue
Block a user