Skip to content

fix(sandbox): preserve run cancellation and persist failure pauses - #828

Open
renaesop wants to merge 1 commit into
BaaRai:mainfrom
renaesop:codex/sandbox-cancel-pause-fix
Open

renaesop wants to merge 1 commit into
BaaRai:mainfrom
renaesop:codex/sandbox-cancel-pause-fix

Conversation

@renaesop

@renaesop renaesop commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

A run deadline or operator cancellation during a sandbox HTTP request currently looks like a runner outage. The outage callback then pauses only the Engine, reports paused_by_orchestrator, and leaves the persisted pause flag unset. The UI shows Paused, but Resume fails with only a paused task can be resumed.

This change preserves caller cancellation/deadline identity for request and response-body errors, guards the unavailable callback against canceled runs, and routes actual runner failures through the persisted task-control transition with a distinct sandbox_unavailable cause. A failed pause write retains the execution barrier and stops the main chat. Explicit Resume can recover an Engine-only pause, while queue, deletion, and terminal-state guards remain in place. Required sandbox execution still has no local fallback.

Validation:

  • The full Go suite passed against an isolated, password-authenticated PostgreSQL instance: 4,126 tests passed and 6 skipped. go vet ./... also passed.
  • 76 focused tests passed with -race, covering cancellation during headers/body reads, real availability failures, persisted pause/resume, storage failure, legacy pause recovery, and queue/deletion/manual-pause guards. The backport onto the deployment's existing patches passed 82 focused tests.
  • The backport is deployed and healthy. Existing paused tasks were preserved during the restart, and a subsequent Resume transition succeeded.

Fixes #797.

@renaesop
renaesop force-pushed the codex/sandbox-cancel-pause-fix branch 2 times, most recently from b0f761e to c6232fc Compare December 2, 2026 09:47
@renaesop
renaesop force-pushed the codex/sandbox-cancel-pause-fix branch from c6232fc to e64d6a6 Compare December 2, 2026 13:49
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.

[Bug] Sandbox Runner timeout causes automatic task pause and inconsistent task state

1 participant