Skip to content

Hand off active turns at committed steps during deployment - #1436

Open
ReganBell wants to merge 6 commits into
mainfrom
turn-handoff-at-committed-step
Open

ReganBell wants to merge 6 commits into
mainfrom
turn-handoff-at-committed-step

Conversation

@ReganBell

@ReganBell ReganBell commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Deploy relinquishment now asks admitted turns to yield after a committed tool result, with a bounded 120-second grace. The next worker resumes the durable run without spending a failure retry. Pi continues a clean native tape without another user message or interruption note; Claude, Codex, and OpenCode respect the same cutoff while retaining their existing recovery behavior.

Loop and cron journals preserve completed stages and the original fire identity across worker replacement. Terminal runs keep a durable delivery-pending marker until delivery and failure-transcript backfill are queued, so a lost completion callback is recoverable. Shared dispatch guards prevent new tool work after the deadline. Committed skill loads restore their original file paths only when currently authorized skill and pack contents match the recorded fingerprint.

Unknown tool outcomes still use the existing recovery path. Foreground sandbox process reattachment beyond the grace period is a separate follow-up; uncommitted external effects are not claimed to execute exactly once. Includes additive handoff-count and delivery-pending migrations.

Validation:

  • 519 affected tests passed across worker, stores, tape, provider adapters, loops, cron, delivery, tools, and skill recovery; additional fingerprint and orchestrator continuation checks passed.
  • Swarm orchestrator, store, and provenance regressions passed after adding handoff signals to the runtime-metadata allowlist; independent security review confirmed request binding remains intact.
  • PostgreSQL store/cron tests and a reopen test for handoff and terminal-delivery checkpoints passed.
  • Typecheck, lint, CLI build, and deployment contract typecheck passed.
  • Real provider QA in a local development instance, exercised through Firefox and Slack: graceful core replacement resumed both Codex and Pi turns; each append executed once and the final reply reported a count of one. Pi resumed seamlessly with no interruption note.
  • Independent adversarial reviews covered lifecycle/durability and provider adapters, including the skill-directory integration after merging main. Findings resolved.

Relinquishing a background cohort now asks each worker to yield its turn
at the next committed tool result instead of running it to completion.
The harness terminates the agent loop after the pending tool results land,
or abandons a model call that outlives BACKGROUND_HANDOFF_GRACE_MS (120 s),
and the worker releases the run lease with the hand-off counted apart from
retry attempts so repeated deployments never park a healthy run. The
incoming cohort claims the run and, when the tape ends cleanly at a
committed step, continues the model conversation with agent.continue()
and no resume note; a tape ending in an interrupted tool call keeps the
existing interruption path.

Work in progress: the seamless-resume decision still treats a fold whose
dangling call was healed with the interrupted marker as clean, so the
hidden-resume-note orchestrator test fails; loop fires are not yet
resumable per item; off-tape delivery and streaming state is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant