commit e7e7555a74d27d53bc1b84f23a6f78fac38cd25e
parent 1f7c69b4912c558f926464e86300a419a4094ac2
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 5 Nov 2026 02:58:32 -0500
umtool: the clip bench's Fetch this window again (umtool fetch --refetch <clip> [--take <t>]: the cached window evicted through the editor, then fetched) as a queue step
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/umtool/app/api/report/takes/tools/route.ts b/umtool/app/api/report/takes/tools/route.ts
@@ -24,6 +24,8 @@ export const dynamic = "force-dynamic";
// POST { project, op: "draft-new", label, group?, style?, patch?, window? }
// umtool take <p> --id <slug of label> --label L --draft
// -> { exit, id, report } [--group G] [--style S] [--patch-json P] [--full | --at A --dur D]
+// POST { project, take?, op: "queue-refetch", clip } QUEUED: umtool fetch <p> --refetch <clip> [--take <t>] (its
+// -> { exit: 0, queued: <qid> } cached windows evicted through the editor, then fetched again)
// POST { project, take, op: "queue-check-joins" } QUEUED: umtool check-joins <p> --take <t> (the measured
// -> { exit: 0, queued: <qid> } SSIM over the master is long: a queue step, its table in
// the step's log on Jobs)
@@ -73,6 +75,18 @@ export async function POST(request: Request) {
const exit = await takeCommand(args, io);
return answer(exit, { id });
}
+ if (body.op === "queue-refetch") {
+ const clip = typeof body.clip === "string" ? body.clip : "";
+ if (!/^[A-Za-z0-9._-]{1,80}$/.test(clip)) return Response.json({ error: "queue-refetch needs a clip id" }, { status: 400 });
+ const step = (await addStep(queueDir(), {
+ argv: ["fetch", project.id, "--refetch", clip, ...(take ? ["--take", take] : [])],
+ label: `fetch ${clip}'s window again (${project.id}${take ? ` take ${take}` : ""})`,
+ target: { project: project.id, take },
+ by: "the umtool app (the clip bench)",
+ })) as { qid: string };
+ kickQueue();
+ return Response.json({ exit: 0, queued: step.qid }, { headers: { "cache-control": "no-store" } });
+ }
if (!take) return Response.json({ error: `${String(body.op)} needs a take` }, { status: 400 });
if (body.op === "draft-from") {
let id = typeof body.id === "string" && body.id ? body.id : null;
diff --git a/umtool/components/projects/ClipBench.tsx b/umtool/components/projects/ClipBench.tsx
@@ -1,5 +1,6 @@
"use client";
+import RefetchButton from "./RefetchButton";
import RejectClip, { type RejectClipControl } from "./review/RejectClip";
import { rejectionOf } from "@/lib/report/rejectReasons.mjs";
import AnchoredNotes, { notesOn } from "@/components/notes/AnchoredNotes";
@@ -3099,6 +3100,8 @@ export default function ClipBench({
>
Fetch whole source via editor
</button>
+ {/* A window known bad, evicted and fetched again: a queue step (lane/ui-simplify). */}
+ <RefetchButton project={data.project} clip={clip.id} take={takeId} disabled={!!busy} />
{storedOffered && (
<StoredUrlCheckbox checked={fromStored} onChange={setFromStored} disabled={!!busy} compact />
)}
diff --git a/umtool/components/projects/RefetchButton.tsx b/umtool/components/projects/RefetchButton.tsx
@@ -0,0 +1,41 @@
+"use client";
+
+import Link from "next/link";
+import { useState } from "react";
+import { buttonVariants } from "@/components/ui/button";
+import { jobsHref } from "@/lib/hrefs";
+
+// FETCH THIS WINDOW AGAIN (lane/ui-simplify, 5 Nov; terminal-only before: `umtool fetch <p> --refetch <clip>`):
+// a window known bad -- a cut that froze, the wrong rendition -- evicted through the editor and fetched again,
+// as a step of the queue (its state, Retry and Cancel on Jobs). POST /api/report/takes/tools {op: "queue-refetch"}.
+export default function RefetchButton({ project, clip, take = null, disabled = false }: { project: string; clip: string; take?: string | null; disabled?: boolean }) {
+ const [busy, setBusy] = useState(false);
+ const [said, setSaid] = useState<{ queued?: string; error?: string } | null>(null);
+ const go = async () => {
+ setBusy(true);
+ const r = await fetch("/api/report/takes/tools", {
+ method: "POST",
+ headers: { "content-type": "application/json" },
+ body: JSON.stringify({ project, take, op: "queue-refetch", clip }),
+ });
+ const j = (await r.json().catch(() => ({}))) as { queued?: string; error?: string };
+ setBusy(false);
+ setSaid(r.ok ? j : { error: j.error ?? `HTTP ${r.status}` });
+ };
+ return (
+ <span className="inline-flex flex-wrap items-center gap-1.5" data-refetch={clip}>
+ <button type="button" data-action="refetch" disabled={disabled || busy} onClick={() => void go()} className={buttonVariants({ variant: "quiet", size: "sm" })} title={`umtool fetch ${project} --refetch ${clip}${take ? ` --take ${take}` : ""}, as a queue step: the cached window evicted, then fetched again`}>
+ Fetch this window again
+ </button>
+ {said?.queued && (
+ <span className="text-[11.5px] text-text-2" data-refetch-queued={said.queued}>
+ queued {said.queued} —{" "}
+ <Link href={jobsHref()} className="ink-link">
+ Jobs
+ </Link>
+ </span>
+ )}
+ {said?.error && <span className="text-[11.5px] text-reject-text">{said.error}</span>}
+ </span>
+ );
+}