commit 2b25376ca2b3be9cc50498698210c980c5125f0b
parent bbf634b9b0bdcf7d911c45b0c6c627f4e9fe9ddd
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 08:49:16 -0400
umtool: R3 follow-up — the run's question is its title (clamped to two lines, all of it in title), the run in the trail; board moves queue instead of dropping; a sweep's Running row links its run page
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
8 files changed, 99 insertions(+), 25 deletions(-)
diff --git a/umtool/components/research/BoardView.tsx b/umtool/components/research/BoardView.tsx
@@ -133,18 +133,26 @@ export default function BoardView({ initial }: { initial: CaseView }) {
el?.scrollIntoView({ block: "nearest" });
}, [listKey]);
+ // The case as the last answer left it: a queued move is computed on it, not
+ // on the render that queued it.
+ const docRef = useRef(doc);
+ docRef.current = doc;
+
const arrange = useCallback(
- async (next: { sections: unknown; order: unknown } | null, keep: string | null) => {
- if (!next) return;
+ async (next: { sections: unknown; order: unknown } | null, keep: string | null): Promise<boolean> => {
+ if (!next) return true;
setBusy(true);
try {
const v = await call<CaseView>(researchCaseApi(doc.id), "PATCH", next);
+ docRef.current = v.case;
refocus.current = keep;
if (keep) setLitId(keep);
setView(v);
setListKey((k) => k + 1);
+ return true;
} catch (e) {
fail(e);
+ return false;
} finally {
setBusy(false);
}
@@ -152,6 +160,40 @@ export default function BoardView({ initial }: { initial: CaseView }) {
[doc.id],
);
+ // MOVES ARE QUEUED, never dropped: an alt+j/k pressed while the last move
+ // is still answering is applied after it, in order, on the case that move
+ // left. A move that fails drops the ones queued behind it (and says why).
+ const moves = useRef<{ kind: "quote" | "section"; id: string; dir: number }[]>([]);
+ const moving = useRef(false);
+ const [queued, setQueued] = useState(0);
+ const pumpMoves = useCallback(async () => {
+ if (moving.current) return;
+ moving.current = true;
+ try {
+ while (moves.current.length) {
+ const m = moves.current.shift()!;
+ setQueued(moves.current.length);
+ const d = docRef.current;
+ const ok =
+ m.kind === "quote"
+ ? await arrange(moveQuote(d, m.id, m.dir), quoteLineId(m.id))
+ : await arrange(moveSection(d, m.id, m.dir), sectionLineId(m.id));
+ if (!ok) moves.current = [];
+ }
+ } finally {
+ moving.current = false;
+ setQueued(0);
+ }
+ }, [arrange]);
+ const queueMove = useCallback(
+ (m: { kind: "quote" | "section"; id: string; dir: number }) => {
+ moves.current.push(m);
+ setQueued(moves.current.length);
+ void pumpMoves();
+ },
+ [pumpMoves],
+ );
+
const patchQuote = useCallback(
async (qid: string, body: Record<string, unknown>) => {
setBusy(true);
@@ -295,10 +337,10 @@ export default function BoardView({ initial }: { initial: CaseView }) {
if (document.querySelector("dialog[open]")) return;
if (e.altKey) {
const dir = e.code === "KeyJ" || e.key === "ArrowDown" ? 1 : e.code === "KeyK" || e.key === "ArrowUp" ? -1 : 0;
- if (!dir || busy) return;
+ if (!dir) return;
e.preventDefault();
- if (litQuote) void arrange(moveQuote(doc, litQuote.id, dir), quoteLineId(litQuote.id));
- else if (litSection) void arrange(moveSection(doc, litSection.id, dir), sectionLineId(litSection.id));
+ if (litQuote) queueMove({ kind: "quote", id: litQuote.id, dir });
+ else if (litSection) queueMove({ kind: "section", id: litSection.id, dir });
return;
}
const focusField = (f: string) => {
@@ -394,7 +436,7 @@ export default function BoardView({ initial }: { initial: CaseView }) {
/>
<div className="grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)_300px]">
<div className="flex min-h-0 min-w-0 flex-col">
- <div className="min-h-0 flex-1 overflow-auto px-7 pb-4 pt-2" data-board-busy={busy ? "" : undefined}>
+ <div className="min-h-0 flex-1 overflow-auto px-7 pb-4 pt-2" data-board-busy={busy || queued > 0 ? "" : undefined}>
{doc.quotes.length === 0 && doc.sections.length === 0 ? (
<EmptyState title="No quotes on this board yet">
<Link prefetch={false} href={researchFromCaseHref(doc)} className="ink-link">
diff --git a/umtool/components/research/RunView.tsx b/umtool/components/research/RunView.tsx
@@ -410,8 +410,10 @@ export default function RunView({ initial }: { initial: View }) {
crumbs={[
{ href: researchHref(), label: "research" },
{ href: runsHref(), label: "runs" },
- { label: `${view.article} ${view.label}` },
+ { href: articleHref({ site: ARTICLES_KEY, id: view.article }, { tab: "iterations" }), label: `${view.article} · ${view.label}` },
+ { label: h.question ?? h.title ?? `${view.article} ${view.label}` },
]}
+ clamp
meta={
<span className="micro" data-run-mode={view.live ? "live" : "replay"}>
Run · {view.live ? "live" : "replay"}
@@ -458,9 +460,6 @@ export default function RunView({ initial }: { initial: View }) {
}
below={
<div className="grid gap-1.5 pt-1">
- <p className="display m-0 max-w-[1000px] text-[17px] leading-[1.25] text-text-2" data-run-question="">
- {h.question ?? h.title ?? "No question recorded"}
- </p>
<div className="flex flex-wrap items-center gap-x-2 gap-y-1 text-[12.5px] text-muted" data-run-meta="">
{meta.map((m, i) => (
<span key={i}>
diff --git a/umtool/components/shell/AppHeader.tsx b/umtool/components/shell/AppHeader.tsx
@@ -28,6 +28,7 @@ export default function AppHeader({
meta,
below,
variant = "page",
+ clamp = false,
className,
}: {
crumbs: Crumb[];
@@ -39,6 +40,8 @@ export default function AppHeader({
/** A full-width row at the foot of the head (a piece's stage stepper). */
below?: React.ReactNode;
variant?: "page" | "bench";
+ /** A long title (a run's question) wraps to two lines, its full text in `title`, instead of one truncated line. */
+ clamp?: boolean;
className?: string;
}) {
const trail = crumbs.slice(0, -1);
@@ -84,8 +87,10 @@ export default function AppHeader({
) : (
<h1
aria-current="page"
+ title={clamp ? here.label : undefined}
className={cn(
- "display m-0 truncate leading-none text-text",
+ "display m-0 text-text",
+ clamp ? "line-clamp-2 max-w-[1000px] leading-[1.15]" : "truncate leading-none",
here.label.length > 36 ? "text-[20px]" : "text-[26px]",
// A place (no trail) is a title in sentence case; a piece's id
// stays exactly as it is spelled.
diff --git a/umtool/e2e/board.spec.ts b/umtool/e2e/board.spec.ts
@@ -115,24 +115,19 @@ test("sections and order: a, alt+j/k across sections, the section menu; claim, n
// Light q1 and move it: down past q2, then on into the top of Approval.
await b.locator('[data-quote="q1"]').click({ position: { x: 8, y: 8 } });
await expect(litId(page)).toHaveAttribute("data-lit-id", "q:q1");
+ // Two moves pressed at once: the second waits for the first's answer and is
+ // applied after it, never dropped -- q1 goes past q2, then past q3.
await page.keyboard.press("Alt+j");
- await expect.poll(() => caseJson("lighthouse-case").quotes.map((q: { id: string }) => q.id).join(" ")).toBe("q2 q1 q3");
- await expect(litId(page)).toHaveAttribute("data-lit-id", "q:q1");
- // A move is refused while the last one is still answering: the file is
- // written before the answer lands, so wait for the board to be idle.
- await expect(page.locator("[data-board-busy]")).toHaveCount(0);
await page.keyboard.press("Alt+j");
await expect.poll(() => caseJson("lighthouse-case").quotes.map((q: { id: string }) => q.id).join(" ")).toBe("q2 q3 q1");
- await expect(litId(page)).toHaveAttribute("data-lit-id", "q:q1");
await expect(page.locator("[data-board-busy]")).toHaveCount(0);
+ await expect(litId(page)).toHaveAttribute("data-lit-id", "q:q1");
await page.keyboard.press("Alt+j");
await expect.poll(() => caseJson("lighthouse-case").quotes.find((q: { id: string }) => q.id === "q1").section).toBe("s1");
await expect(b.locator('[data-group="s1"] [data-quote="q1"]')).toBeVisible();
- await expect(page.locator("[data-board-busy]")).toHaveCount(0);
await expect(litId(page)).toHaveAttribute("data-lit-id", "q:q1");
// And back up: alt+k.
await expect(litId(page)).toHaveAttribute("data-lit-id", "q:q1");
- await expect(page.locator("[data-board-busy]")).toHaveCount(0);
await page.keyboard.press("Alt+k");
await expect.poll(() => caseJson("lighthouse-case").quotes.find((q: { id: string }) => q.id === "q1").section).toBe(null);
await expect(litId(page)).toHaveAttribute("data-lit-id", "q:q1");
@@ -162,7 +157,6 @@ test("sections and order: a, alt+j/k across sections, the section menu; claim, n
await expect(b.locator('[data-group="s2"] [data-quote="q2"]')).toBeVisible();
// A section moves too: The keeper above Approval.
await b.locator('[data-section="s2"]').click();
- await expect(page.locator("[data-board-busy]")).toHaveCount(0);
await page.keyboard.press("Alt+k");
await expect.poll(() => caseJson("lighthouse-case").sections.map((s: { id: string }) => s.id).join(" ")).toBe("s2 s1");
});
diff --git a/umtool/e2e/fixtures/run-trace-fixture.mjs b/umtool/e2e/fixtures/run-trace-fixture.mjs
@@ -23,6 +23,8 @@ import { ARCHIVE, DRIFTED_QUOTE, RESEARCH_PHRASE } from "./research-fixture.mjs"
export const RUN_ARTICLE = "runfix";
export const TURNS_ARTICLE = "runfix-turns";
export const LIVE_ARTICLE = "runfix-live";
+/** The editor job the live run's iteration names (running.spec places a Running row by it). */
+export const LIVE_JOB = "e2e-run-live";
export const RUN_QUESTION = "What did the harbor channels say about the lighthouse budget?";
/** The quote the trace drops, and why. */
export const DROPPED = {
@@ -188,7 +190,7 @@ export function makeRunTraceFixture({ articles, source }) {
put(
path.join(dir(LIVE_ARTICLE), "iteration.json"),
- iteration(LIVE_ARTICLE, { model: "claude-sonnet-5-5", question: "Is the ferry running?", scope: { channels: ["harbor-radio"] }, status: "running", endedAt: undefined }),
+ iteration(LIVE_ARTICLE, { model: "claude-sonnet-5-5", question: "Is the ferry running?", scope: { channels: ["harbor-radio"] }, status: "running", endedAt: undefined, jobId: LIVE_JOB }),
);
put(path.join(dir(LIVE_ARTICLE), "trace.jsonl"), jsonl(liveTraceHead(source)));
return { dir };
diff --git a/umtool/e2e/run-trace.spec.ts b/umtool/e2e/run-trace.spec.ts
@@ -53,7 +53,11 @@ test.afterAll(() => {
test("a traced run: the head, its steps with their spend, the lit step's detail, a dropped quote and why", async ({ page }) => {
await page.goto(runHref(RUN_ARTICLE, 1));
await expect(page.locator("[data-run-mode]")).toHaveAttribute("data-run-mode", "replay");
- await expect(page.locator("[data-run-question]")).toHaveText(RUN_QUESTION);
+ // The question is the title (clamped to two lines, all of it in `title`); the run is in the trail.
+ const crumbs = page.getByRole("navigation", { name: "Breadcrumb" });
+ await expect(crumbs.locator("h1")).toHaveText(RUN_QUESTION);
+ await expect(crumbs.locator("h1")).toHaveAttribute("title", RUN_QUESTION);
+ await expect(crumbs.getByRole("link", { name: `${RUN_ARTICLE} · i1` })).toHaveAttribute("href", `/articles/${RUN_ARTICLE}?tab=iterations`);
const meta = page.locator("[data-run-meta]");
await expect(meta).toContainText("Sonnet 5.5 · Haiku 4.5 extractor");
await expect(meta).toContainText("harbor-radio, night-desk");
diff --git a/umtool/e2e/running.spec.ts b/umtool/e2e/running.spec.ts
@@ -3,6 +3,8 @@ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { portFor } from "yt-dlp-transcript-common/lib/ports.mjs";
+import { LIVE_ARTICLE, LIVE_JOB } from "./fixtures/run-trace-fixture.mjs";
+import { runHref } from "../lib/research/runs-hrefs";
// ---------------------------------------------------------------------------
// P2b: what is running, in the rail, and drafts as decisions in the Inbox.
@@ -84,14 +86,14 @@ test("the rail lists the editor's running and queued jobs, a draft's spend, and
// A running draft: its kind in words, its article (from the log's first
// line: no iteration names the job), its live spend in Meter, its turns,
- // a bar -- and a link to the article's iterations, not the editor.
+ // a bar -- and, a sweep, a link to its run page (R3), not the editor.
const draft = r.locator("[data-running=e2e-draft-run]");
await expect(draft).toHaveAttribute("data-running-state", "running");
await expect(draft.locator("[data-running-kind]")).toHaveText("Report draft");
await expect(draft.locator("[data-running-spend]")).toHaveText("$0.31");
await expect(draft.locator("[data-running-target]")).toHaveText("zeta i7 · 3/12 turns");
await expect(draft.locator("[data-job-progress]")).toHaveAttribute("data-job-progress", "25");
- await expect(draft.locator("a")).toHaveAttribute("href", "/articles/zeta?tab=iterations");
+ await expect(draft.locator("a")).toHaveAttribute("href", runHref("zeta", 7));
// A sync: its channel, its count; it has no piece, so it links the editor's /jobs.
const sync = r.locator("[data-running=e2e-sync]");
@@ -153,6 +155,25 @@ test("nothing running, the editor's token unset, and an editor that does not ans
await expect(r.locator("[data-today-spend]")).toHaveText("$0.42 today");
});
+test("a report-draft row links its run page when it is a sweep (R3), its article's iterations when not", async ({ page }) => {
+ await editorJobs(page.request, "ok", [
+ // Placed by its iteration's jobId (the run fixture's live sweep).
+ { id: LIVE_JOB, kind: "report-draft", status: "running", queuedAt: NOW - 20_000, startedAt: NOW - 20_000 },
+ // Placed by its log: a narration step, not a sweep.
+ { id: "e2e-draft-narrate", kind: "report-draft", status: "running", queuedAt: NOW - 10_000, startedAt: NOW - 10_000, log: ["narrate of zeta i1 on qwen3:8b (the local model)"] },
+ ]);
+ await page.goto("/tools");
+ const r = running(page);
+ const sweep = r.locator(`[data-running=${LIVE_JOB}]`);
+ await expect(sweep.locator("[data-running-target]")).toContainText(`${LIVE_ARTICLE} i1`);
+ await expect(sweep.locator("a")).toHaveAttribute("href", runHref(LIVE_ARTICLE, 1));
+ await expect(r.locator("[data-running=e2e-draft-narrate] a")).toHaveAttribute("href", "/articles/zeta?tab=iterations");
+ // The link lands on the live run.
+ await sweep.locator("a").click();
+ await expect(page).toHaveURL(new RegExp(`/research/runs/${LIVE_ARTICLE}/1$`));
+ await expect(page.locator("[data-run-mode]")).toHaveAttribute("data-run-mode", "live");
+});
+
// ─── Drafts as decisions ────────────────────────────────────────────────────
const DRAFTS = "reports/p2b-drafts";
diff --git a/umtool/lib/activity.ts b/umtool/lib/activity.ts
@@ -9,6 +9,7 @@ import { askEditor, EditorError, editorUrl, type EditorErrorReason } from "./art
import { ARTICLES_KEY } from "./articles/key.mjs";
import { sitesPaths } from "./articles/sites";
import { articleHref, mixHref, projectHref } from "./hrefs";
+import { hasRunPage, runHref } from "./research/runs-hrefs";
import { recentJobs as recentChainJobs, runningJob, type Job } from "./jobs";
import { recentJobs as recentRenders, type RenderJob } from "./mix";
import { labelFor } from "./paths";
@@ -114,6 +115,12 @@ export function entryStates(events: Record<string, unknown>[]): ActivityProgress
const storeArticleHref = (article: string) => articleHref({ site: ARTICLES_KEY, id: article }, { tab: "iterations" });
+// A report-draft SWEEP links its run page (R3, /research/runs/<article>/<n>:
+// the steps live, as it runs); any other placed job its article's iterations.
+function placeHref(j: { kind?: string }, place: JobPlace): string {
+ return j.kind === "report-draft" && !place.research && hasRunPage(place.task) ? runHref(place.article, place.n) : storeArticleHref(place.article);
+}
+
function fromChain(j: Job): ActivityItem {
const entries = entryStates(j.events);
const start = j.events.find((e) => e.ev === "start") as { entries?: number } | undefined;
@@ -311,7 +318,7 @@ function editorItem(j: EditorJob, place: JobPlace | null, rank: number, spend: n
error: null,
meter: queued ? { fraction: null, text: queueText(j.queue) } : { fraction: p?.fraction ?? null, text: p?.text ?? null },
...(rank === 0 ? { generation: true, spend } : {}),
- href: place ? storeArticleHref(place.article) : jobsHref,
+ href: place ? placeHref(j, place) : jobsHref,
...(place ? {} : { external: true }),
rank,
lane: isLane(j.kind),