Mission Recovery
The existing mission conductor supports optional task dependency recovery. Enable the
Mission retry context and correction recovery
Choose a style with the prompt-led orchestration guide.
The existing mission conductor supports optional task dependency recovery. Enable the new fields with `MissionPlan.recoveryPolicy`:
{
"version": 1,
"attemptHistory": true,
"inputIdentity": true
}
At least one cycle must declare `dependsOn`; an empty array declares a root. Omitting the policy retains the existing ledger bytes, including #4558 dependency missions. Either feature can be enabled independently. Once enabled, retain it on resume. These are conductor fields under the existing Mission Protocol v1 schema definitions, registered in the schema catalog; they add no worker protocol features, transport, store, or CLI command.
Retry the failed cut
The conductor first drains independent work. A failed task blocks its descendants; completed siblings remain intact. `authorizeRetry` must still return the existing host-owned evidence from `prepareWorkerRetry`. The hook receives the repaired cycle prompt so it can resolve that exact brief. Evidence must include a confirmed predecessor stop, task binding and resolved health windows. The supervised launcher remains responsible for enforcing these windows and remaining budgets. One retry per node is allowed across resumes; history never grants additional attempts.
With `attemptHistory: true`, `recovery.details.history[cycleId]` retains up to three failed attempts, each with an attempt number, prior error (at most 2048 characters), and available verifier output (at most 4096 characters). The retry's worker prompt includes this bounded history as diagnostic data. It is passed through the same adapter and `runWorker` seam, with unchanged `invocation.retry` authorization. Failure context is diagnostic, not acceptance or authority. History persists even when another failure exhausts the retry allowance.
Resume after a correction
With `inputIdentity: true`, each completed cycle records `inputIdentity`, a SHA-256 hash of its full declared spec (including optional JSON `inputs`), sorted parent IDs, parent input identities and hashes of stored parent output/verifier results. Object key order does not affect hashes. File contents are included only when the host declares their values or digests in `inputs`; there are no implicit read traces.
On resume, a changed spec, declared input, or parent output invalidates that task and its descendants. For an intentional rerun with the same spec, pass `recoveryPolicy.corrections: ["cycle-id"]` on that resume. Remove this request on subsequent resumes unless another correction is intended. Unknown IDs and corrections without identity tracking or a prior ledger are rejected. Failed nodes still require the retry gate; a correction cannot reset their allowance.
`recovery.details.stale` records invalidated completed work still awaiting execution; `invalidated` retains the cumulative set affected by corrections. A plan-only resume records staleness without executing workers. An executing resume reruns only the affected cut in dependency order, removing successful cycles from `stale`. Diamond joins wait for both parents. Unrelated outputs and costs survive; stale results cannot participate in best-output selection. The prior ledger is left unchanged. Enabling identity on an older ledger conservatively invalidates completed work without an identity rather than treating it as current.
Evidence and limits
REF-3285 (fork() for Agents; arXiv 2026, corpus A−, GRADE MODERATE) reports prompt repair with failure context fixed 14/18 versus 6/18 for blind retries, and recovery 100% versus 55% for whole replay. Injected failures always cleared on the first retry, and the results are Claude-family only.
REF-3127 (From Agent Loops to Deterministic Graphs; preprint, GRADE VERY LOW) reports hash-identity invalidation preserved unrelated work 3/3 versus 0/3 for both loop baselines, with 382 versus about 11.7k input tokens. It was slower on intermediate edits (73.6 s versus 31–39 s). The study used two tasks × three repeats and one model family. These findings motivate the opt-in behavior; they do not establish general recovery reliability. Read-trace fact propagation and event-log replay/forking remain out of scope.
Evaluate then grow
Opt into evidence-led planning on the same conductor with:
const plan = {
missionId: 'investigation', goal: 'Explain the observed result',
completionCriterion: 'Each explanation has checked supporting evidence',
growthPolicy: { version: 1, mode: 'evaluate-then-grow', taskCap: 20 },
cycles: [{ id: 'observe', runtime: 'codex', prompt: 'Collect observations', dependsOn: [] }],
} satisfies MissionPlan;
const ledger = await new MissionConductor({
runWorker,
evaluateGrowth: ({ ledger, evidence }) => ({
version: 1,
reason: ledger.growth!.rounds === 0 ? 'Check the observed lead' : 'Evidence is sufficient',
evidence,
cycles: ledger.growth!.rounds === 0
? [{ id: 'check', runtime: 'codex', prompt: 'Check the lead', dependsOn: ['observe'] }]
: [],
}),
}).conduct(plan, pool);
`evaluateGrowth` is a host callback, supplied alongside the existing `runWorker` seam. It receives cloned plan/ledger snapshots and current completed evidence references. A reference has `version: 1`, `cycleId`, a SHA-256 `resultDigest` over that cycle result, and `inputIdentity` when identity tracking is enabled. These are observations, not independent acceptance. Workers cannot append tasks directly. The callback must return a reason and at least one current reference; it may cite any subset of the completed evidence. Stale, unknown and duplicate references are rejected. The host remains responsible for assessing the evidence's quality.
All seed and appended tasks declare `dependsOn`, including `[]` for roots. The conductor evaluates only after the current dependency batch drains successfully. Joins dispatch only when all parents complete (the supporting REF-3285 behavior). Proposals are validated atomically against the existing dependency graph before any task is appended: IDs must be unique, parents must exist and cycles are rejected. A failed appended task blocks only its descendants; independent tasks still run. Outstanding failures stop further evaluation until the existing retry/resume path resolves them. Retry authorization and its lifetime allowance are unchanged.
`growthPolicy.maxRounds` defaults to 3; zero permits evaluation but no task growth. `taskCap` is required and counts all declared tasks, including seed tasks, failed tasks and blocked tasks. Each nonempty appended batch consumes one growth round; an empty decision finishes without spending a round. A final evaluation may return no growth at an exact budget boundary. A nonempty proposal exceeding either budget is recorded but never appended or dispatched. Too many seed tasks stop before any worker executes. `ledger.growth.status: "budget-exhausted"` and `report` explain which limits stopped the mission; resume retains the counters and cannot reset the budget. A missing or throwing evaluator produces `evaluation-failed` with a report. Plan-only passes do not evaluate or grow the plan.
The existing ledger retains `growth` version 1, effective budgets, initial task IDs, round count and each decision's reason, exact evidence references, proposed task specs and disposition. No additional engine or store is introduced. Resume with the same seed tasks, policy and ledger; saved appended tasks are rehydrated before the existing dependency/recovery checks. Completed decisions are retained without reevaluation while their cited evidence is current. With `recoveryPolicy.inputIdentity`, corrections rerun stale descendants, including appended tasks, and a changed cited result triggers a new evaluation. Old decision references remain an audit history. An exhausted growth ledger remains exhausted. Omitting `growthPolicy` retains the existing ledger bytes, including dependency-only and correction-recovery missions.
These fields are versioned definitions under the existing Mission Protocol v1 schema and registered in its catalog: `missionGrowthPolicyV1`, `missionGrowthEvidenceV1`, `missionGrowthDecisionV1`, `missionGrowthLedgerV1`. They do not change the frozen worker definitions.
Research scope for growth
REF-3289 (DAGent: Evaluate-then-Grow Planning; NeurIPS 2026 poster, corpus A−, GRADE MODERATE) reports 47.3 / 55.3 / 65.0 on BrowseComp-Plus, GAIA and xbench with Qwen3-32B, versus 42.0 / 50.5 / 61.0 for a same-family plan-then-patch variant and 33.3 / 42.7 / 55.0 for a single upfront plan. Plan-then-patch costs about 27–35% more wall time. These are scored short-answer tasks only; the core result uses one mid-sized backbone, code is partial, and some ablations are near seed variance. The findings motivate this opt-in mode without establishing broader mission performance. Training-time DAGRPO and automatic topology learning remain out of scope.
Bounded Ralph bodies inside tasks (#4591)
A task can opt in with `loop: {version: 1, criterion: "tests pass", maxIterations: 3}`. The same field belongs to a FlowPlaybook step; `flowPlaybookToMission` retains it for dependency flows and typed flows. Dependency flows project `depends_on` onto the existing task cut (omitted prerequisites mean a root). Loops do not enable typed routing implicitly. Existing missions, flows and standalone Ralph runs without this field retain their behavior and serialized ledger bytes.
const conductor = new MissionConductor({
runWorker, // existing host executor; receives invocation.loop for local iterations
verifyLoop: async ({ cycle, iteration, result }) => {
// Host maps iteration.criterion to its trusted local check, without evaluating
// model-authored commands. Existing host approval precedes protected effects.
const checked = await checkCriterion(iteration.criterion, cycle, result);
return { passed: checked.passed, output: checked.output };
},
});
const plan = {
missionId: 'fix-and-consume', goal: 'repair', completionCriterion: 'consumed',
cycles: [
{ id: 'fix', runtime: 'codex', prompt: 'fix the failed check', dependsOn: [],
loop: { version: 1, criterion: 'tests pass', maxIterations: 3 } },
{ id: 'consume', runtime: 'codex', prompt: 'consume result', dependsOn: ['fix'] },
{ id: 'independent', runtime: 'codex', prompt: 'unrelated work', dependsOn: [] },
],
};
const ledger = await conductor.conduct(plan, executors);
The host must supply `verifyLoop` when executing a loop; planning needs no verifier. The existing `runWorker` receives `invocation.loop` with the criterion, ceiling, 1-based `iteration`, and optional `previousVerifierOutput`. Use that diagnostic to repair only the current task. After each successful worker execution, the host verifier checks the declared criterion and returns `{passed: boolean, output: string}`. A worker completion claim alone cannot satisfy the loop. The verifier is a host callback, not a new CLI evaluator or a change to standalone Ralph criteria.
The first passing check ends the body. Only its final output, worker result and successor echo enter normal node completion and typed flow validation. Inner iterations neither release descendants nor spend typed flow transition visits. The existing cycle result gains `loop` with version, criterion, ceiling, `iterations`, `status` (`passed`, `exhausted`, `failed`) and `lastVerifierOutput` (up to 4096 characters). `cost` includes every returned local iteration, including exhausted attempts; thrown worker calls cannot report unreturned spend.
Exhaustion records `MISSION_LOOP_EXHAUSTED` on that node with the last worker output and verifier diagnostic. A throwing worker, non-completed adapter result, missing verifier, malformed verdict or throwing verifier fails that node immediately. The existing dependency cut blocks its descendants and preserves completed siblings. Retries still require `authorizeRetry` with owned termination and remaining budgets; local iterations grant no graph retries. A newly authorized node retry starts a fresh bounded body. `attemptHistory` carries the last loop verifier output into its diagnostic prompt. Appended growth tasks use the same body and failure cut.
Resume carries completed bodies without replay. Changing or removing a saved body requires `recoveryPolicy.inputIdentity`; the existing identity invalidates that node and its descendants. Typed flows additionally retain their frozen definition requirement. Recovering a file effect without a retained verified body result fails explicitly; loop bodies never bypass the existing effect ledger or host approvals.
`missionLoopV1` and `missionLoopResultV1` are registered definitions in the existing Mission Protocol v1 owner. The existing playbook owner uses the same revision-1 body shape. `maxIterations` must be an integer from 1 through 1000, with an explicit nonblank criterion. Neither field creates a new schema family or command.
Evidence caveat for loops inside graphs
The loops-inside-graphs evidence is weak. REF-3293 (practitioner article “Loops and Graphs”, grade C, GRADE VERY LOW) has no data and no measured outcomes. It suggests local validation loops, correction of only the failed unit, and approval before the first protected effect; it does not demonstrate a performance benefit. REF-3285 (corpus A−) supports the node-level retry lifecycle. REF-3127 (VERY LOW) reports losing unrelated work on updates, 0/3 for loops versus 3/3 for a DAG. These issue-supplied observations motivate the opt-in shape; they are not AIWG measurements or strong comparative evidence.