commit 06a417082b48e40811b89064a613720508f395ba
parent 08a807581f0f501600b2d177f11c9871df1794aa
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 13 Oct 2026 22:32:29 -0400
common: a site build's end runs the auto-continue scan too (release 28 F1)
A run held because nothing it would sweep is in a build waits for one: the
end of a site build job (publish-build-site, build-export, build-deploy,
build-all, build-deploy-all) now runs the scan beside a report-draft's
(SCAN_ON_END), so it continues once the operator has built the site. Test:
a held run continues when a build job holding its channel ends.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 37 insertions(+), 3 deletions(-)
diff --git a/common/controller/researchAutoContinue.test.ts b/common/controller/researchAutoContinue.test.ts
@@ -298,6 +298,34 @@ test("channels in no build are left out with a warning; with nothing left the ru
await ended(s.jobId!);
});
+test("a held run continues when a site build that holds its channel ends", async () => {
+ const article = "synth-auto-rebuilt";
+ const n = await makeRun(article, {
+ proposals: [prop("p01", "create-channel", { fields: { name: "Synth Rebuilt" } }, "done", { channel: "synth-rebuilt", doneAt: "2026-10-13T10:00:00.000Z" })],
+ });
+ assert.equal((await maybeAutoContinue(article, n, deps())).outcome, "held");
+ armResearchAutoContinue(deps(), { bootScan: false, env: {} });
+ // The operator puts it on a site and builds it: the build job's end runs the scan.
+ const build = await runManagedFunction({
+ kind: "build-export",
+ queueKey: "",
+ paths,
+ fn: async () => writeBuild("synth-rebuilt", ["synth-rebuilt"], new Date(Date.now() + 120_000)),
+ });
+ assert.ok(build.ok);
+ void build.stream.cancel();
+ await build.done;
+ const rec = await until(async () => {
+ const r = await recOf(article, n);
+ return r.autoContinue?.status === "continued" ? r : null;
+ }, "the continuation after the build");
+ const sweep = (await sweepsOf(article, n))[0]!;
+ assert.equal(rec.autoContinue!.by, sweep.n);
+ assert.deepEqual(sweep.scope?.channels, ["synth-rebuilt"]);
+ await ended(sweep.jobId!);
+ await researchAutoContinueTick();
+});
+
test("an idle boot arms nothing: no listener, and the heartbeat's call is a no-op", async () => {
const article = "synth-auto-idle";
const n = await makeRun(article, { channels: ["synth-kitchen"] });
diff --git a/common/controller/researchAutoContinue.ts b/common/controller/researchAutoContinue.ts
@@ -9,7 +9,8 @@
// - the end of a job the run waits on: settle (researchRuns.ts) names an
// `auto` run's pending editor jobs, and the registry's job-end listener
// takes the run of one that ended; a `report-draft` job's end (the
-// research job itself, among others) runs the scan below;
+// research job itself, among others) or a site build's runs the scan
+// below;
// - the scan, on the editor's heartbeat and once at boot: the research
// iterations (a proposals.json) of every article, a run already finished
// with (continued, or not `auto`) remembered and not read again.
@@ -64,6 +65,10 @@ import { enqueueReportDraft, REPORT_DRAFT_JOB_KIND, type ReportDraftDeps } from
import { markContinued, researchState, takeWatchedRun } from "./researchRuns";
export const CLAIM_STALE_MS = 10 * 60_000;
+
+// The jobs whose end runs the scan: a generation's (the research job's own
+// among them) and a site build's (a held run may now have its build).
+export const SCAN_ON_END = new Set([REPORT_DRAFT_JOB_KIND, "publish-build-site", "build-export", "build-deploy", "build-all", "build-deploy-all"]);
export const UNBUILT_CHECK = "unbuilt channels";
export type AutoContinueResult =
@@ -323,8 +328,9 @@ export function armResearchAutoContinue(deps: ReportDraftDeps, o: { log?: (line:
(r) => report(run.article, run.n, r, null, state.log),
(e) => state.log?.(`research auto-continue: ${run.article} i${run.n}: ${(e as Error).message}`),
);
- } else if (job.kind === REPORT_DRAFT_JOB_KIND) {
- // A research job's end (or any generation's): the scan finds its run.
+ } else if (SCAN_ON_END.has(job.kind)) {
+ // A research job's end (or any generation's) — the scan finds its run —
+ // or a site build's, which may hold what a held run waits for.
void scanAutoContinue(state.deps, state.log).catch(() => {});
}
});