Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
feat(harness): doer no-verdict recovery, session-limit awareness, and resume-from-outcome (#1073)
Brad Barbind1dada55d097
diff --git a/.ai/docs/loop-system.md b/.ai/docs/loop-system.mdindex 01aaf20942..427faf3b6f 100644--- a/.ai/docs/loop-system.md+++ b/.ai/docs/loop-system.md@@ -26,12 +26,28 @@ outer-loop (OpenClaw cron → Claude Code headless)failed attempts exhausted → rescue branch + reset → end (salvage PR)```-**The doer chunks its own work too.** Its prompt tells it: if the task won't fit-in one budgeted session, stop early at a coherent, committable slice and report-`remaining` — a clean partial slice is success; racing the turn/budget cap to a-broken finish is failure. Gate-green slices are checkpointed and pushed, skip-the judge, reset the failure counter, and hand the next session the remaining-work — so no session ever needs to be bigger than what it can finish cleanly.+**The doer chunks its own work too.** Its prompt tells it its exact session+caps (turns + budget) and: if the task won't fit in one budgeted session, stop+early at a coherent, committable slice and report `remaining` — a clean partial+slice is success; racing the turn/budget cap to a broken finish is failure.+Gate-green slices are checkpointed and pushed, skip the judge, reset the+failure counter, and hand the next session the remaining work — so no session+ever needs to be bigger than what it can finish cleanly.++**A doer session with no verdict never ends the run.** A capped/garbled doer+session (no JSON handoff) is checkpointed as-is, counted as one failed attempt,+and the task continues with a fresh session; `blocked` is reserved for the doer+*explicitly* reporting a hard impossibility. (#1031's second run died at T4 on+the old no-verdict → blocked behavior.)++**Re-dispatch = resume.** The full plan (tasks + statuses) is written into+`outcome.json`, which is committed with the branch (#1070). Re-dispatching the+same binding on the same branch resumes deterministically: `done`/`flagged`+tasks are skipped without spending a session, `pending`/`failed` ones re-run,+and the prior run's `unverified`/`questions` flags carry into the new PR body.+A prior `shipped` outcome never resumes — PR-feedback re-entry gets a fresh+plan. The outer loop needs zero judgment: "run the same dispatch command again"+is always the right recovery move.**Nothing is ever thrown away.** Every doer pass is committed and force-with-leasepushed to the loop branch before gates run; failed attempts stay on the branch asdiff --git a/.ai/docs/outer-loop.md b/.ai/docs/outer-loop.mdindex c7c716150d..36594076ca 100644--- a/.ai/docs/outer-loop.md+++ b/.ai/docs/outer-loop.md@@ -105,8 +105,10 @@ dead, no `outcome.json`):2. Check origin: `git ls-remote origin "refs/heads/loop/<id>"`.- **Branch exists** → re-dispatch the SAME binding in a worktree based onit: `crbn new loop/<id> --base origin/loop/<id> --yes`, then the normal- harness command. The loop re-plans, sees the committed progress, and- continues from where it died. `openPr` is idempotent — same branch, same PR.+ harness command. The loop **resumes** — the committed `outcome.json`+ carries the plan and task statuses, so concluded tasks are skipped for+ free and only pending/failed ones run. `openPr` is idempotent — same+ branch, same PR.- **No branch** → nothing was produced; re-dispatch fresh (base `origin/main`).3. Before re-dispatching after a second consecutive crash, capture evidenceinstead of retrying blind: post the tail (~50 lines) of the dispatchdiff --git a/packages/harness/AGENTS.md b/packages/harness/AGENTS.mdindex ed7ddbdef8..f6a63a5cc4 100644--- a/packages/harness/AGENTS.md+++ b/packages/harness/AGENTS.md@@ -7,6 +7,8 @@ AI agent harness — binding parsing, gate execution, the conductor loop, ledger- **Parse bindings from `.loop.md` frontmatter** — `parseBinding(md)` extracts `id`, `kind`, `risk`, `title`, `acceptance[]`, and optional `issue` number- **Commit early, push often** — every doer pass is checkpoint-committed and force-with-lease pushed BEFORE gates run; failures fix forward on the checkpoint, never `git checkout -- .`- **The doer self-chunks** — a session that can't finish its task stops at a coherent slice and reports `remaining`; gate-green slices checkpoint, skip the judge, don't count as failed attempts, and the next session continues from them+- **A doer with no verdict never ends the run** — a capped/garbled session is checkpointed, counted as one failed attempt, and the task continues with a fresh session; `blocked` is only for an explicit doer-reported impossibility+- **Re-dispatch = resume** — `resolvePlan` reads the branch-committed `outcome.json`: non-shipped prior runs restore their plan, skip done/flagged tasks free, and carry `unverified`/`questions` forward- **Run floor gates on the committed state** — `FLOOR_GATES` (lint, conformance, clobbers) are the minimum quality bar; a red gate means the next attempt fixes forward, and exhausted tasks park their attempts on `loop-rescue/<id>/t<k>` before resetting- **Append to the JSONL ledger after every iteration** — `appendLedger(path, entry)` records iteration, task, change, gates, decision (keep/checkpoint/revert), reason, timestamp, and any `unverified`/`questions`/`assumptions`- **Distinguish disproof from absence of proof** — a behavior gate that reached the state and saw the change fail reverts the iteration; a gate that could not verify either way (`unverified`) keeps judge-approved work and ships it as a draft PR labeled `agent:needs-verification`diff --git a/packages/harness/src/index.ts b/packages/harness/src/index.tsindex c4ff51b788..f57be0eb89 100644--- a/packages/harness/src/index.ts+++ b/packages/harness/src/index.ts@@ -27,7 +27,9 @@ export { runLoop } from "./runner/loop";export {buildPlan,buildPlannerPrompt,- parsePlanResult+ parsePlanResult,+ type ResolvedPlan,+ resolvePlan} from "./runner/plan";export {buildDoerPrompt,diff --git a/packages/harness/src/runner/loop.test.ts b/packages/harness/src/runner/loop.test.tsindex 0e198dee11..a59bea3860 100644--- a/packages/harness/src/runner/loop.test.ts+++ b/packages/harness/src/runner/loop.test.ts@@ -1,4 +1,4 @@-import { mkdtempSync, rmSync } from "node:fs";+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";import { tmpdir } from "node:os";import { join } from "node:path";import { afterEach, beforeEach, describe, expect, it } from "vitest";@@ -141,7 +141,9 @@ describe("runLoop", () => {expect(commits).toHaveLength(1);// Commit early, push often — the checkpoint hit origin before gates ran.expect(pushes.some((p) => p.includes("--force-with-lease"))).toBe(true);- expect(out.plan).toEqual([{ title: BINDING.title, status: "done" }]);+ expect(+ out.plan?.map((t) => ({ title: t.title, status: t.status }))+ ).toEqual([{ title: BINDING.title, status: "done" }]);expect(readLedger(ledgerPath).at(-1)?.decision).toBe("keep");});@@ -281,6 +283,44 @@ describe("runLoop", () => {expect(last?.reason).toContain("loop-rescue/bug-1/t1");});+ it("continues with a fresh session (never blocks) when the doer returns no verdict", () => {+ const { shell, commits } = recordingShell();+ const deps = makeDeps({+ claude: scriptedClaude(+ ["…capped mid-edit, no json at all…", doer({ change: "finished" })],+ [judge({ approved: true, unmet: [] })]+ ),+ shell+ });++ const out = runLoop(BINDING, makeConfig(), deps);++ expect(out.state).toBe("shipped");+ expect(out.iterations).toBe(2);+ // The capped session's tree was checkpointed, not thrown away or blocked.+ expect(commits).toHaveLength(2);+ const ledger = readLedger(ledgerPath);+ expect(ledger[0]?.decision).toBe("checkpoint");+ expect(ledger[0]?.reason).toContain("without a verdict");+ expect(ledger.at(-1)?.decision).toBe("keep");+ });++ it("ends plateau (work preserved) when the doer never produces a verdict", () => {+ const deps = makeDeps({+ claude: scriptedClaude(["no json", "no json"], []),+ shell: dirtyShell()+ });++ const out = runLoop(BINDING, makeConfig({ taskMaxAttempts: 2 }), deps);++ expect(out.state).toBe("plateau");+ expect(+ readLedger(ledgerPath).every(+ (e) => e.decision === "checkpoint" || e.decision === "revert"+ )+ ).toBe(true);+ });+it("blocks when the doer reports it cannot proceed — after checkpointing its work", () => {const { shell, commits } = recordingShell();const deps = makeDeps({@@ -394,7 +434,9 @@ describe("runLoop", () => {const out = runLoop(BINDING, makeConfig(), deps);expect(out.state).toBe("shipped");- expect(out.plan).toEqual([{ title: BINDING.title, status: "flagged" }]);+ expect(+ out.plan?.map((t) => ({ title: t.title, status: t.status }))+ ).toEqual([{ title: BINDING.title, status: "flagged" }]);expect(out.unverified?.[0]).toContain("WITHOUT judge review");expect(commits).toHaveLength(1);expect(readLedger(ledgerPath).at(-1)?.decision).toBe("keep");@@ -427,6 +469,47 @@ describe("runLoop", () => {]);});+ it("resumes a prior non-shipped run: concluded tasks are skipped, flags carried over", () => {+ // A prior run (e.g. before a crash / doer cap) left its plan in+ // outcome.json — committed with the branch. Task 1 is already done.+ mkdirSync(join(dir, ".ai", "runs", "bug-1"), { recursive: true });+ writeFileSync(+ join(dir, ".ai", "runs", "bug-1", "outcome.json"),+ JSON.stringify({+ state: "blocked",+ iterations: 3,+ reason: "doer capped",+ unverified: ["carried: needs human verification of X"],+ plan: [+ { title: "models", detail: "d", criteria: [0], status: "done" },+ { title: "wiring", detail: "d", criteria: [1], status: "pending" }+ ]+ })+ );+ let doerSessions = 0;+ const claude = (req: ClaudeRequest): ClaudeResult => {+ if (req.prompt.includes("You are the DOER")) {+ doerSessions++;+ return { text: doer({ change: "wiring" }), costUsd: 0, sessionId: "s" };+ }+ return {+ text: judge({ approved: true, unmet: [] }),+ costUsd: 0,+ sessionId: "s"+ };+ };+ const deps = makeDeps({ claude, shell: dirtyShell() });++ const out = runLoop(BINDING, makeConfig(), deps);++ expect(out.state).toBe("shipped");+ // Only the pending task spent a session — the done one was skipped free.+ expect(doerSessions).toBe(1);+ expect(out.plan?.map((t) => t.status)).toEqual(["done", "done"]);+ // The prior run's flags survive the re-dispatch.+ expect(out.unverified).toContain("carried: needs human verification of X");+ });+describe("with a planner-decomposed binding", () => {const BIG: Binding = {id: "feat-1",@@ -458,7 +541,9 @@ describe("runLoop", () => {const out = runLoop(BIG, makeConfig(), deps);expect(out.state).toBe("shipped");- expect(out.plan).toEqual([+ expect(+ out.plan?.map((t) => ({ title: t.title, status: t.status }))+ ).toEqual([{ title: "migration", status: "done" },{ title: "service + UI", status: "done" }]);diff --git a/packages/harness/src/runner/loop.ts b/packages/harness/src/runner/loop.tsindex e3eb3756ea..ceb301201f 100644--- a/packages/harness/src/runner/loop.ts+++ b/packages/harness/src/runner/loop.ts@@ -1,7 +1,7 @@import type { Binding } from "../binding";import { FLOOR_GATES, runGates } from "../gates";import { appendLedger, readLedger } from "../ledger";-import { buildPlan } from "./plan";+import { resolvePlan } from "./plan";import {buildDoerPrompt,buildJudgePrompt,@@ -15,8 +15,7 @@ import type {LoopOutcome,RunnerConfig,RunnerDeps,- Shell,- TaskStatus+ Shell} from "./types";/** Anything uncommitted — tracked modifications AND untracked files. */@@ -89,17 +88,23 @@ export function runLoop(const { claude, shell, now, log } = deps;const { cwd, ledgerPath } = config;let iteration = 0;- // Proof gaps on KEPT work and product questions raised along the way — both- // ride the outcome so the PR/issue gets flagged instead of the work vanishing.- const unverified: string[] = [];- const questions: string[] = [];// Consecutive tasks concluded without any judge verdict (even after retries)// — a persistent judge outage shouldn't keep burning doer budget.let judgeMissingStreak = 0;- // Phase 0: PLAN — systematic chunking, in code not in model judgment.- const tasks = buildPlan(binding, config, deps);- const status: TaskStatus[] = tasks.map(() => "pending");+ // Phase 0: PLAN — systematic chunking, in code not in model judgment. A+ // prior non-shipped run on this branch RESUMES: its plan and task statuses+ // come back from outcome.json, concluded tasks are skipped for free.+ const { tasks, status, resumed, ...carried } = resolvePlan(+ binding,+ config,+ deps+ );+ // Proof gaps on KEPT work and product questions raised along the way — both+ // ride the outcome so the PR/issue gets flagged instead of the work+ // vanishing. Seeded from the resumed run so its flags survive re-dispatch.+ const unverified: string[] = [...carried.unverified];+ const questions: string[] = [...carried.questions];const end = (state: LoopOutcome["state"], reason: string): LoopOutcome => {log({ event: "loop:end", state, reason, iterations: iteration });@@ -109,6 +114,8 @@ export function runLoop(reason,plan: tasks.map((t, i) => ({title: t.title,+ detail: t.detail,+ criteria: t.criteria,status: status[i] ?? "pending"})),...(unverified.length > 0@@ -122,12 +129,18 @@ export function runLoop(const task = tasks[k];if (!task) continue;const taskLabel = `${k + 1}/${tasks.length}: ${task.title}`;+ // Resumed runs skip already-concluded tasks — no doer/judge spend.+ if (status[k] === "done" || status[k] === "flagged") {+ log({ event: "task:skip", task: taskLabel, status: status[k], resumed });+ continue;+ }const startSha = headSha(shell, cwd);const ctx: TaskContext = {task,index: k + 1,total: tasks.length,- ...(startSha ? { startSha } : {})+ ...(startSha ? { startSha } : {}),+ limits: { turns: config.doerMaxTurns, usd: config.doerMaxBudgetUsd }};// The doer chunks its own work too: a gate-green SLICE (doer reports// `remaining`) is progress — it resets the failure counter and skips the@@ -244,6 +257,25 @@ export function runLoop(}const gatesGreen = Object.values(gates).every(Boolean);+ // 6-pre. NO VERDICT — the doer session was cut off (cap) or garbled.+ // Absence of a verdict is not a blocker: the tree is already+ // checkpointed and pushed; count a failed attempt and give the task a+ // FRESH session with this in the ledger. (#1031's run died here.)+ if (doer.noVerdict) {+ failed++;+ appendLedger(ledgerPath, {+ iteration,+ change: doer.change,+ gates,+ decision: "checkpoint",+ reason:+ "fixing forward: doer session ended without a verdict (likely hit its turn/budget cap)",+ task: taskLabel,+ at: now()+ });+ continue;+ }+// 6a. SLICE — the doer chunked itself: a gate-green, committed slice// with work remaining is progress. Checkpoint it, skip the judge// (nothing complete to approve yet), reset the failure counter, anddiff --git a/packages/harness/src/runner/plan.test.ts b/packages/harness/src/runner/plan.test.tsindex 5794128640..53f8db442e 100644--- a/packages/harness/src/runner/plan.test.ts+++ b/packages/harness/src/runner/plan.test.ts@@ -1,6 +1,9 @@-import { describe, expect, it } from "vitest";+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterEach, describe, expect, it } from "vitest";import type { Binding } from "../binding";-import { buildPlan, parsePlanResult } from "./plan";+import { buildPlan, parsePlanResult, resolvePlan } from "./plan";import type { ClaudeResult, RunnerConfig, RunnerDeps } from "./types";const BINDING: Binding = {@@ -84,6 +87,84 @@ describe("parsePlanResult", () => {});});+describe("resolvePlan", () => {+ const dirs: string[] = [];+ afterEach(() => {+ for (const d of dirs.splice(0)) rmSync(d, { recursive: true, force: true });+ });++ function cwdWithOutcome(outcome: unknown): string {+ const cwd = mkdtempSync(join(tmpdir(), "plan-resume-"));+ dirs.push(cwd);+ if (outcome !== undefined) {+ mkdirSync(join(cwd, ".ai", "runs", BINDING.id), { recursive: true });+ writeFileSync(+ join(cwd, ".ai", "runs", BINDING.id, "outcome.json"),+ JSON.stringify(outcome)+ );+ }+ return cwd;+ }++ it("resumes a non-shipped prior run: statuses and flags carried, no planner session", () => {+ const cwd = cwdWithOutcome({+ state: "blocked",+ unverified: ["needs human check"],+ questions: ["is X intentional?"],+ plan: [+ { title: "a", detail: "d", criteria: [0, 1], status: "done" },+ { title: "b", detail: "d", criteria: [2], status: "flagged" },+ { title: "c", detail: "d", criteria: [3], status: "failed" }+ ]+ });+ let planner = 0;+ const r = resolvePlan(+ BINDING,+ { ...config, cwd },+ deps(() => {+ planner++;+ return { text: "", costUsd: 0, sessionId: "s" };+ })+ );+ expect(planner).toBe(0);+ expect(r.resumed).toBe(true);+ expect(r.tasks.map((t) => t.title)).toEqual(["a", "b", "c"]);+ // done/flagged stay concluded; failed re-runs as pending+ expect(r.status).toEqual(["done", "flagged", "pending"]);+ expect(r.unverified).toEqual(["needs human check"]);+ expect(r.questions).toEqual(["is X intentional?"]);+ });++ it("never resumes a shipped outcome (PR-feedback re-entry gets a fresh plan)", () => {+ const cwd = cwdWithOutcome({+ state: "shipped",+ plan: [{ title: "a", detail: "d", criteria: [0], status: "done" }]+ });+ const r = resolvePlan(+ BINDING,+ { ...config, cwd },+ deps(() => {+ throw new Error("planner dead"); // falls back to whole-binding task+ })+ );+ expect(r.resumed).toBe(false);+ expect(r.status).toEqual(["pending"]);+ });++ it("falls through to fresh planning when no outcome exists", () => {+ const cwd = cwdWithOutcome(undefined);+ const r = resolvePlan(+ BINDING,+ { ...config, cwd },+ deps(() => {+ throw new Error("planner dead");+ })+ );+ expect(r.resumed).toBe(false);+ expect(r.tasks).toHaveLength(1);+ });+});+describe("buildPlan", () => {it("skips the planner session entirely for loop-sized bindings (≤2 criteria)", () => {let called = 0;diff --git a/packages/harness/src/runner/plan.ts b/packages/harness/src/runner/plan.tsindex 7049139878..a8fe7e99f4 100644--- a/packages/harness/src/runner/plan.ts+++ b/packages/harness/src/runner/plan.ts@@ -1,6 +1,14 @@+import { readFileSync } from "node:fs";import type { Binding } from "../binding";+import { outcomePath } from "../layout";import { groomingNotes, tryExtractJson } from "./prompts";-import type { PlanTask, RunnerConfig, RunnerDeps } from "./types";+import type {+ LoopOutcome,+ PlanTask,+ RunnerConfig,+ RunnerDeps,+ TaskStatus+} from "./types";/*** Systematic chunking, owned by the harness — not by the groomer, not by the@@ -123,3 +131,82 @@ export function buildPlan(return [wholeTask(binding)];}}++/** What `resolvePlan` hands the loop: tasks, their starting statuses, and any+ * flags carried over from the run being resumed. */+export type ResolvedPlan = {+ tasks: PlanTask[];+ status: TaskStatus[];+ /** Prior run's proof gaps / questions — re-seeded so the PR keeps its flags. */+ unverified: string[];+ questions: string[];+ resumed: boolean;+};++/**+ * RESUME, deterministically: a prior non-shipped run on this branch left its+ * full plan (tasks + statuses) in `outcome.json`, which is committed with the+ * branch. Re-dispatching the same binding picks the plan back up — concluded+ * tasks (`done`/`flagged`) are skipped without spending a session, pending and+ * failed ones re-run. No re-planning, no model judgment, no outer-loop smarts+ * required: "run it again" is always the right recovery move.+ *+ * A prior `shipped` outcome never resumes (PR-feedback re-entry is new work —+ * it gets a fresh plan), and any unreadable/invalid outcome falls through to+ * fresh planning.+ */+export function resolvePlan(+ binding: Binding,+ config: RunnerConfig,+ deps: RunnerDeps+): ResolvedPlan {+ try {+ const prior = JSON.parse(+ readFileSync(outcomePath(config.cwd, binding.id), "utf8")+ ) as Partial<LoopOutcome>;+ const plan = prior?.plan;+ if (+ prior?.state !== "shipped" &&+ Array.isArray(plan) &&+ plan.length > 0 &&+ plan.every(+ (t) => typeof t?.title === "string" && Array.isArray(t?.criteria)+ )+ ) {+ const valid = binding.acceptance.length;+ const tasks: PlanTask[] = plan.map((t) => ({+ title: t.title,+ detail: typeof t.detail === "string" ? t.detail : "",+ criteria: t.criteria.filter(+ (i): i is number =>+ typeof i === "number" && Number.isInteger(i) && i >= 0 && i < valid+ )+ }));+ const status: TaskStatus[] = plan.map((t) =>+ t.status === "done" || t.status === "flagged" ? t.status : "pending"+ );+ deps.log({+ event: "plan:resume",+ priorState: prior.state,+ tasks: tasks.map((t, i) => `${t.title} [${status[i]}]`)+ });+ return {+ tasks,+ status,+ unverified: Array.isArray(prior.unverified) ? prior.unverified : [],+ questions: Array.isArray(prior.questions) ? prior.questions : [],+ resumed: true+ };+ }+ } catch {+ /* no prior outcome — fresh run */+ }+ const tasks = buildPlan(binding, config, deps);+ return {+ tasks,+ status: tasks.map(() => "pending"),+ unverified: [],+ questions: [],+ resumed: false+ };+}diff --git a/packages/harness/src/runner/prompts.ts b/packages/harness/src/runner/prompts.tsindex 005fd1eb5e..1f9418de6d 100644--- a/packages/harness/src/runner/prompts.ts+++ b/packages/harness/src/runner/prompts.ts@@ -10,6 +10,9 @@ export type TaskContext = {total: number;/** SHA at task start — the judge diffs `<sha>..HEAD` to see the task's work. */startSha?: string;+ /** The doer's session caps, so it can budget its slices instead of getting+ * cut off mid-edit with no verdict. */+ limits?: { turns: number; usd: number };};function taskSection(binding: Binding, ctx: TaskContext | undefined): string {@@ -94,7 +97,7 @@ Your job THIS iteration:- Module code: keep ONE \`<module>.service.ts\` and ONE \`<module>.models.ts\`; never scatter new ones.- Correctness: write a test that FAILS on the bug/missing-feature and PASSES after your change. Report its exact command.-Chunk your own work — you have a hard turn/budget cap:+Chunk your own work — you have a hard turn/budget cap${ctx?.limits ? ` (about ${ctx.limits.turns} tool-use turns / $${ctx.limits.usd} for THIS session — a session that hits the cap mid-edit reports nothing and wastes its work)` : ""}:- If the task will not fit comfortably in this session, STOP EARLY at a COHERENT SLICE: code that compiles, is lint-clean, and is safe to commit as-is. Report what's left in \`remaining\` — the loop checkpoints your slice and gives a fresh session this context to continue.- A clean partial slice is SUCCESS; a complete-but-broken sprint to the buzzer is failure. Never race your limits, and never leave the tree half-edited at the end of your session.- Prior slices are already committed — build on them, don't redo them.@@ -158,16 +161,16 @@ End your reply with EXACTLY one fenced json block, no prose after it:export function parseDoerResult(text: string): DoerResult {const raw = tryExtractJson<Partial<DoerResult>>(text);- // No verdict ⇒ the doer was cut off (limit) or misbehaved. Block rather than- // silently revert — we can't trust what it left in the tree.+ // No verdict ⇒ the doer was cut off (limit) or misbehaved. Absence of a+ // verdict is not a blocker: the loop checkpoints the tree, counts a failed+ // attempt, and continues the task with a fresh session.if (!raw) {return {- change: "(no verdict)",+ change: "(doer session ended without a verdict)",packages: [],testCommand: "",touchedUI: false,- blocked:- "doer returned no JSON verdict (possibly hit a turn/budget limit)"+ noVerdict: true};}const assumptions = Array.isArray(raw.assumptions)diff --git a/packages/harness/src/runner/types.ts b/packages/harness/src/runner/types.tsindex dac9d6d0da..57b039b3b1 100644--- a/packages/harness/src/runner/types.ts+++ b/packages/harness/src/runner/types.ts@@ -38,8 +38,18 @@ export type LoopOutcome = {* grooming resolves them BEFORE the next dispatch.*/questions?: string[];- /** The task plan and where each task ended up — the PR renders this. */- plan?: { title: string; status: TaskStatus }[];+ /**+ * The task plan and where each task ended up. Carries the full task+ * definitions (detail + criteria) so a re-dispatch on the same branch can+ * RESUME: concluded tasks are skipped, pending/failed ones re-run.+ * The PR renders this as a checklist.+ */+ plan?: {+ title: string;+ detail: string;+ criteria: number[];+ status: TaskStatus;+ }[];};/**@@ -68,6 +78,14 @@ export type DoerResult = {* questions — the loop never stops to ask.*/assumptions?: string[];+ /**+ * Set when the doer produced NO parseable verdict (capped session, garbled+ * output). Absence of a verdict is not a blocker: the tree is checkpointed+ * as-is, the iteration counts as a failed attempt, and a FRESH session+ * continues the task — the run never dies over one capped session+ * (#1031's T4 ended a whole run this way).+ */+ noVerdict?: true;/** Set when the doer cannot proceed without a human — surfaces as a BLOCKED* outcome. Reserved for hard impossibilities, never questions of preference. */blocked?: string;