Skip to content

fix(sandbox): serialize E2B release transitions#4355

Merged
WillemJiang merged 1 commit into
bytedance:mainfrom
March-77:codex/serialize-e2b-release-4333
Jul 22, 2026
Merged

fix(sandbox): serialize E2B release transitions#4355
WillemJiang merged 1 commit into
bytedance:mainfrom
March-77:codex/serialize-e2b-release-4333

Conversation

@March-77

Copy link
Copy Markdown
Contributor

What changed

  • serialize E2B acquire() and the full release() state transition with the existing per-user/thread lock
  • keep the provider-wide registry lock out of output sync and other remote I/O
  • add a concurrency regression test that blocks output sync and verifies acquire cannot discover or create early
  • document the E2B lifecycle invariant in backend/AGENTS.md

Why

release() removed the active mappings before syncing outputs and publishing the warm-pool entry. A concurrent acquire for the same thread could observe neither state and reconnect or create a sandbox while release was still operating on the previous client.

Impact

Within one Gateway process, a same-thread acquire now waits for release to finish, then reclaims the warm sandbox. Multi-process coordination remains outside this issue's stated scope.

Validation

  • pytest tests/test_e2b_sandbox_provider.py -q — 64 passed
  • ruff check on the changed Python files — passed
  • ruff format --check on the changed Python files — passed
  • full backend suite — 8411 passed, 81 skipped, 87 environment-dependent failures on Windows (existing POSIX path, symlink, shell, and permission assumptions; no E2B provider failures)

Closes #4333

@March-77
March-77 marked this pull request as ready for review July 22, 2026 02:02
@github-actions github-actions Bot added area:docs Documentation and Markdown only risk:medium Medium risk: regular code changes size/S PR changes 20-100 lines labels Jul 22, 2026
@WillemJiang WillemJiang added this to the 2.1.0 milestone Jul 22, 2026
@WillemJiang
WillemJiang merged commit 4dd7caf into bytedance:main Jul 22, 2026
19 checks passed
yogyoho added a commit to yogyoho/eai-flow-main that referenced this pull request Jul 23, 2026
…UI hardening

- bytedance#4117 XSS hardening (isSafeHref, iframe sandbox, safeLocalStorage)
- bytedance#4354 streaming chunk batcher for large file tools
- bytedance#4294 LLM concurrency cap + burst-rate retry shedding
- bytedance#4355 E2B release serialization
- bytedance#4267 transient image context cleanup
- bytedance#4374 AI disclaimer (bytedance#4373 reasoning-effort default)
- bytedance#4337 /goal length validation + counter
- bytedance#4278/bytedance#4302/bytedance#4312 URL encoding fixes
- bytedance#4375 list_uploaded_files schema fix
- bytedance#4288 uploads markdown companion name claim
- bytedance#4258 remove frontend debug logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Documentation and Markdown only risk:medium Medium risk: regular code changes size/S PR changes 20-100 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(sandbox): serialize E2B acquire and release per thread

2 participants