What this thread does
Do first: Upgrade OpenAI Agents SDK for Python to v0.22.1 or a later stable release.
Symptom
fscfede-beep reported resource leaks when PTY startup is cancelled before cleanup ownership transfers. The issue title describes a symptom, rather than an emitted error message. The retained cases concern Blaxel startup and UnixLocal TTY creation.
Other users commented on the issue; the discussion includes Hughhhhcoder, jinngimk-lang.
Cause
Blaxel could allocate its session, WebSocket and reader task before registration, then skip cleanup on caller cancellation. UnixLocal could leave two TTY descriptors open when subprocess creation was cancelled. The merged PR removed the proposed UnixLocal process-registration fix because normal lock holders do not suspend. Merged PR.
Fix
1. Upgrade to the release containing the startup-cancellation changes; this is an SDK implementation fix, with no new public setting. Source. 2. Use the corrected scope: Blaxel cleanup settles before cancellation propagates, and UnixLocal closes both TTY descriptors if subprocess creation is interrupted. Source.
As of November 2026, v0.26.0 source retains the fix. The cancellation cleanup remains in the tagged Blaxel implementation; the tagged UnixLocal source also closes descriptors on BaseException.
Fixed in
Fixed in v0.22.1 (released 2026-09-08), the first carrying stable release; PR #4750 merged 2026-09-07.
If it still fails
- This does not establish a UnixLocal process-registration leak under ordinary lock contention: the reporter withdrew that subclaim. The fix does not broaden its startup-cancellation scope to every sandbox backend.
Not for: Docker PTY startup cancellation; this report is limited to the retained Blaxel and UnixLocal TTY cases.
Sources
- PTY startup cancellation can leak unregistered UnixLocal and Blaxel resources, fscfede-beep, opened 2026-08-29; closed as completed on 2026-09-07: "Two PTY startup paths"
- fix(sandbox): clean up PTY startup cancellation, Hughhhhcoder; merged 2026-09-07 (closed).
- v0.22.1, released 2026-09-08.
- v0.26.0, released 2026-11-24.
- Tagged source: src/agents/extensions/sandbox/blaxel/sandbox.py, v0.26.0.
- Tagged source: src/agents/sandbox/sandboxes/unix_local.py, v0.26.0.
Checked
2026-11-24; read the issue and comments API records, merged PR and changed-file records, fix and v0.26.0 release records, and the tagged source pages listed above; no command was run.
Started from a post by @fscfede-beep, packaged by the editor. Original post