Skip to content

api: default omitted v2 connect timeouts to five minutes - #58

Merged
zibi-pplx merged 1 commit into
mainfrom
fix/e2b-v2-connect-default-timeout
Oct 6, 2026
Merged

zibi-pplx merged 1 commit into
mainfrom
fix/e2b-v2-connect-default-timeout

Conversation

@zibi-pplx

@zibi-pplx zibi-pplx commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

E2B SDK 2.51/2.52 omits the connect timeout unless the caller supplies it (upstream SDK change). The v2 server contract defaults this omission to 300 seconds, but SPACE previously routed v2 through the legacy activity-only omission behavior.

For a sandbox with a 120-second AccessIdle policy and no later extension, the previous SDK's explicit timeout: 300 established a five-minute minimum. The new SDK's {} only touched activity, leaving a 120-second deadline.

  • Normalize omitted timeout to 300 in a dedicated v2 connect wrapper before calling the shared handler.
  • Reject explicit zero with an E2B 400 response on v2; retain explicit positive values and existing memory validation.
  • Preserve legacy connect omission semantics, stored lifecycle policy, and the existing extend-only deadline behavior.
  • Extend the existing route/simulator regression matrix: empty body, {}, explicit short/default/long timeout, running and resumed sandboxes, 120/300/900-second policies, and a pre-existing later extension.

No template sizing, networking policy, create behavior, deployment configuration, or other compatibility changes.

Severity

High: an SDK upgrade can reduce the post-connect lifetime of sandboxes with short idle policies, causing earlier suspension or deletion than the caller's default five-minute guarantee.

Validation

  • Reproduced before the fix: the route/simulator regression fails on started / 120s / v2 empty body because the requested extension is absent. The explicit-zero route assertion also fails before the fix (404 instead of 400).
  • cargo fmt -p pplx-space-api -- --check: passed.
  • cargo test --locked -p pplx-space-api --lib connect -- --nocapture --test-threads=2: 37 passed, 0 failed, 0 ignored. This includes the 54-case deadline matrix and v2 explicit-zero rejection.
  • cargo clippy --locked -p pplx-space-api --all-targets --all-features -- -D warnings: passed.
  • Tests use a task-local PostgreSQL 18 instance initialized with the repository's space-nextest-postgres-setup binary and selected via SPACE_TEST_POSTGRES_ADMIN_URL; SPACE_CI_REQUIRE_TEST_DEPS=1 was set. No database-dependent test was skipped.
  • The route/simulator matrix asserts the acknowledged access_extended_until and retained lifecycle policy. It does not simulate the native lifecycle scheduler.
  • cargo test --locked -p pplx-space-sbx-mgr --lib connect_floor_survives_activity_without_changing_policy_or_other_clocks -- --nocapture: 1 passed, 0 failed, 0 ignored. This existing native scheduler test independently verifies that extensions do not shorten the effective deadline and survive subsequent activity without rewriting policy.
  • pre-commit run gitleaks: passed; staged code, surrounding context and proposed PR text reviewed for public-safe content, with no findings in that scope.

Task-owned PostgreSQL fixtures were removed; no test databases remain. No live sandbox, Firecracker, Kubernetes, deployment or full-workspace qualification is claimed.

Assistance

Perplexity Computer implemented this change, added the regression coverage, and drafted this description.

@zibi-pplx
zibi-pplx marked this pull request as ready for review October 5, 2026 19:17
@kumarpallav-pplx
kumarpallav-pplx self-requested a review October 5, 2026 19:35
@zibi-pplx
zibi-pplx added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit 45b55ad Oct 6, 2026
27 of 29 checks passed
@zibi-pplx
zibi-pplx deleted the fix/e2b-v2-connect-default-timeout branch October 6, 2026 03:15
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.

3 participants