Skip to content

Bound Sandbox SDK requests and cleanup waits - #39

Closed
starmorph wants to merge 2 commits into
mainfrom
codex/issue-26-sandbox-transport-deadlines
Closed

starmorph wants to merge 2 commits into
mainfrom
codex/issue-26-sandbox-transport-deadlines

Conversation

@starmorph

Copy link
Copy Markdown
Contributor

The SDK's initial connect-token requests currently ignore operation signals, and cleanup can wait indefinitely after an answer is computed. Supply the public SandboxesClient with an owned typed HTTP transport that carries cancellation into control/token requests and response-body reads. Bound pacing, retries, file transfers, stream waits, workspace lookup, and termination.

Default calls/control requests have a 30-second budget; termination has an independent 10 seconds. Exec streams retain their workload deadline. A late create ID retains a cleanup observer with a fresh budget. If cancellation prevents receiving an ID, the remote outcome remains unknown and the mandatory provider lifetime remains the backstop; emit sandbox_create_unknown. Retry create only after a known rejection such as 429.

Preserve SDK authentication, workspace/region selection, user-agent, error decoding and data-plane signals. SDK stays pinned at 1.3.0; the already locked openapi-fetch 0.15.2 becomes an explicit dependency. No global fetch replacement or private SDK access is used in production. The token gap also remains in the verified SDK 1.5.0 source.

Validation:

  • Six real-SDK local-HTTP regressions failed before the fix: 30 ms token deadlines took roughly 185–198 ms, and create/get/terminate returned after cancellation.
  • 44 focused tests passed, including token/body/socket cancellation, late create cleanup, pre-aborted work, retry/pacing cancellation, auth/error compatibility, and a computed result surviving a terminate timeout.
  • Independently rerun typecheck/full suite: 105 passed, 1 live-model test skipped. Socket tests synchronize entry into the stalled body and observe actual connection closure. Frozen install/diff checks passed.

No live Render deployment or paid-provider validation was performed. Unknown remote create outcomes remain explicitly documented rather than treated as confirmed cleanup.

Fixes #26.

@jacobprall

Copy link
Copy Markdown
Collaborator

Closing in favor of an upstream fix. The diagnosis is right: connect-token requests ignore the caller's signal, and terminate has no budget. But a custom openapi-fetch transport with AsyncLocalStorage signal propagation is a lot for a template to carry and teach, and it hasn't been checked on real Render.

Thanks for the thorough repro, which is quoted in the SDK issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[P2] Bound SDK token acquisition and cleanup waits

2 participants