runner: gate stage handoff on settled verified session export

This commit is contained in:
2026-10-20 20:54:51 +01:00
parent 3d35e8a863
commit f87e1ed488
18 changed files with 791 additions and 26 deletions
+34
View File
@@ -0,0 +1,34 @@
# Session export handoff gate
Production model visits may publish their output to subsequent stages only after
their exact recorded native session has settled and a complete, nonempty,
nontruncated export file has passed normal-file and size verification. Ownership
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
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.
The checkpoint reserves the workspace durably even though no agent is executing.
`SessionExportReservations` supplies those reservations to launch admission;
`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.
After a successful automatic or manual repair, the worker re-verifies ownership
(including backend/reference) and the actual file, then rebuilds memory, turn
history and stage budgets from the recorded visits and follows the saved target.
Starting the successor consumes the gate in the same transaction as `BeginStep`;
terminal targets consume it with `FinishRun`. A restart before either transaction
can resume the saved target, but never replays the completed owner. Cancellation,
unconfirmed cleanup or an overlapping active workspace prevents continuation.
New repair files belong in the original private visit directory, not public
handoff files. Historical public repair paths remain verifiable for compatibility.
Only unowned injected test executors are exempt from native-session enforcement.
An original computation failure routed directly to failure stays a failure even
when its best-effort diagnostic export cannot be recovered.