Skip to content

Finish interrupted Codex runs from authenticated evidence (T63) #237

Closed

Description

@erickb336

Sage task T63
Parent tracking issue: #88.

An interrupted Codex child releases its admission slot, but its logbook run stays running. The current finish-run tool requires a saved report, which an interrupted assignment cannot supply. This leaves a stale run that can block later work.

Outcome

Let the authenticated chief finish that exact run from its saved interruption evidence. The chief selects an existing non-success status: blocked, question, or failed. Do not invent a report, record a verdict, change task state, or infer success.

Scope and acceptance

  • Extend the existing sage_finish_run surface; preserve its recorded-report form and behavior.
  • Use identifiers available through supported native tools. Do not require fixture-only journal access.
  • Authenticate the current chief, fixed project and logbook, owner epoch, exact preparation, reservation, binding, and immutable interruption receipt.
  • Reject unsupported, missing, foreign, conflicting, completed-success, or damaged evidence before writes.
  • Finish only the matching run. Preserve other runs, task state, findings, verdicts, reports, admission history, and mode.
  • Preserve identical retries and crash recovery. Reject changed requests and conflicting terminal results.
  • Retain ownership while descendants remain active. Never permit a new writer or lead to overlap an unfinished team.
  • Keep the existing report-based finish path and CLI behavior unchanged.
  • Prove the native chief can finish an interrupted run, retry it unchanged, then create an eligible replacement run through supported tools.

Verification

Use focused behavioral tests, detached-main failure proofs, and targeted negative controls. Run build, check, and the full suite with fake process commands first on PATH. Run the native interruption lifecycle on the final commit; label simulated model responses. Require two clean independent code, security, and QA review cycles before merge.

Ownership and boundaries

Codex owns this unit. Start from main 8cffddd. Avoid Claude PR #140 task-set, replan, merge-check, logbook-view, and verdict bodies. The principle-delivery experiment remains a separate local plan awaiting agreement. This unit does not enable installed automatic Sage or establish cross-session transfer.

Design review: admission race

A check inside the logbook lock alone does not protect every role. Reviewers can have another running run. A continuation can validate that run, then reserve admission after interruption finishing checks the current journal. Admission uses its own atomic publication sequence.

The implementation must coordinate run closure with admission publication for all supported roles. Include a deterministic interleaving regression for a continuation validated before closure but published during it. Also cover already reserved, unbound descendants. Do not reduce the scope to leads to avoid this case. Preserve legitimate later reuse, exact historical retries, and crash recovery.

Implementation contract after design review

Preserve the existing {assignment, reportHash} report input. Add the exclusive interruption form {outcome: "interrupted", run, status}. The chief already receives the run ID from the run-creation tool; no internal journal identifier is required. The status is blocked, question, or failed.

Use begin-finish and finish-complete events in the existing atomic admission journal. Begin validates the exact interrupted binding and request, and refuses unsettled work across its historical actor subtree, including unbound reservations and pending continuations. A pending record prevents conflicting preparation, reservation, binding, and continuation publication. Journal retries must recheck it.

Under the existing logbook lock, save a typed ending receipt and the exact one-row run update. Keep the report field empty. Only acknowledge completion after that result is durable. The acknowledgement identifies the exact request and receipt, not just the actor. A crash retains the pending record for an identical retry; no timeout releases it. After completion, ordinary eligible actor reuse remains possible.

Historical retries preserve their saved result and cannot clear a later pending record. Validate pending-table deltas before recovery writes. Include tests for both publication orders, stale acknowledgements, every crash window, and later actor reuse. This replaces the rejected assumption that the logbook lock alone makes the admission check stable.

Activity

  1. added
    codex
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    codex

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions