runner: keep export handoffs nonterminal through recovery

This commit is contained in:
2026-10-20 21:19:26 +01:00
parent ca78b24f47
commit ec3eda9e05
28 changed files with 370 additions and 82 deletions
+13 -2
View File
@@ -7,8 +7,10 @@ reads and final export attempts have bounded contexts independent of execution
cancellation. Unconfirmed cleanup never exports or advances.
An export failure retains the computed step, outcome, target, output and file
evidence. The run fails closed with an export-gate diagnostic, not an invented
model failure. A separate `session_export_gates` checkpoint is committed with the
evidence. The run parks nonterminally in `waiting`, with
`export_pending_sequence` identifying the computed visit and no `finished_at`.
This is not a human decision or a model failure. A separate
`session_export_gates` checkpoint is committed with the
step and its existing durable export job. Model retry is refused for that
checkpoint: recovery reads only the original session. Missing exact ownership
cannot be reconstructed or guessed and remains blocked.
@@ -18,6 +20,15 @@ The checkpoint reserves the workspace durably even though no agent is executing.
`PendingSessionExportGate(runID, sequence)` identifies the exact quiescent visit
eligible for export-only repair. Cancellation releases the reservation without
discarding or replaying the computation, and prevents automatic continuation.
The repair handler must permit `waiting` only when that predicate is true for
the requested sequence; unrelated human/resource waits remain ineligible.
Both CLI wait paths keep waiting for export recovery; `run --wait` still pauses
for genuine human decisions. Lifecycle events carry the same pending sequence,
and a lifecycle frame with zero/absent sequence clears it. Status-less repair
freshness frames leave it unchanged. Continuation is `waiting -> running`, never
terminal -> running. Startup normalizes historical failed/interrupted export
checkpoints back to waiting before clients attach.
After a successful automatic or manual repair, the worker re-verifies ownership
(including backend/reference) and the actual file, then rebuilds memory, turn