[PR #310] [CLOSED] fix(api): default autoPause to false, matching the E2B API #337

Closed
opened 2026-10-29 14:22:21 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/310
Author: @nblintao
Created: 9/21/2026
Status: ❌ Closed

Base: main ← Head: fix/auto-pause-default


📝 Commits (1)

  • dc07100 fix(api): default autoPause to false, matching the E2B API

📊 Changes

9 files changed (+70 additions, -21 deletions)

View changed files

📝 docs/src/concepts/sandboxes/auto-eviction.md (+8 -8)
📝 docs/src/concepts/sandboxes/index.md (+1 -1)
📝 scripts/tests/e2e/lib/helpers.sh (+9 -0)
📝 scripts/tests/e2e/suites/03_sandbox_timeout.sh (+38 -1)
📝 src/api/generated/src/models.rs (+3 -3)
📝 src/api/impls/sandbox.rs (+4 -4)
📝 src/api/openapi.yml (+3 -3)
📝 src/orchestrator/store/metadata.rs (+1 -1)
📝 src/orchestrator/tests.rs (+3 -0)

📄 Description

What

autoPause defaults to false on sandbox creation, as the schema documents
and as E2B's API behaves. A create that does not mention it now deletes the
sandbox at its timeout instead of pausing it.

Why

AgentENV's README offers the E2B SDK "without any code changes", and this is
one default where the same code gets a different sandbox.

  • E2B defaults autoPause to false (spec/openapi.yml);
    AgentENV carries the same field with the same description and default: true
    while the handlers read a missing value as a pause.
  • The SDKs never send the field unless the caller asks for a pause, by design:
    the Python SDK says sending false "would be indistinguishable from an
    explicit "kill" and would override the default the API owns", and
    documents the API's default to its users as "kill". An implementation
    cannot rely on clients spelling false out.
  • SandboxLifecycle is byte-identical in both specs, so one unchanged create
    reports onTimeout: "kill" from E2B and "pause" here.
  • A pause nobody asked for is not free: it writes the sandbox's memory snapshot
    to the node's disk, and nothing reclaims it — evict_expired_sandboxes skips
    anything that is not Running, cleanup_orphan_artifacts keeps every
    artifact that still has a record, and the store has no quota.

N/A — a spec-conformance fix; the divergence is visible in the two specs.

Scope and non-goals

Included: the two create handlers, the metadata default, the three create
schemas and their generated constructors, the two docs pages that state the
default, and e2e coverage of the mapping on both create paths. Excluded: autoPauseMemory, which AgentENV does not implement;
any reclamation policy for sandboxes that are paused deliberately.

Design and behavior changes

  • Both create handlers pause only on an explicit autoPause: true, and
    Default for SandboxMetadata follows.
  • Nothing else about pause, resume or eviction changes; an explicit
    POST /sandboxes/{id}/pause behaves as before.

Compatibility and operations

  • Public API or generated protocol: the documented default changes value. The
    field, its type and its description are unchanged.
  • Configuration or defaults: a create that omits autoPause now deletes at
    the timeout.
    autoPause: true restores the previous behavior. Happy to
    gate this on a server-side configuration flag instead if you would rather
    not move the default in one step.
  • Snapshot manifest, artifact layout, or storage format: N/A.
  • Upgrade and rollback: no migration. Sandboxes already paused are untouched.
  • Host requirements, permissions, ports, or dependencies: N/A.

Validation

  • make fmt
  • make clippy
  • make test-unit
  • Relevant Rust integration tests — 03_sandbox_timeout covers the new
    default; run locally in compose mode, see below
  • make -C services test — N/A (services/ untouched)
  • Generated clients/server regenerated with the documented make target
    (make agentenv-server)
  • Documentation updated
  • Benchmarks or performance comparison completed — N/A
cargo fmt --all -- --check     # clean
cargo clippy -- -D warnings    # clean
cargo test -p agentenv --lib   # 896 passed
make agentenv-server           # the three constructors below, and nothing else
SUITE_FILTER=03_sandbox_timeout.sh E2E_MODE=compose scripts/tests/e2e/run_e2e.sh
                               # 14 assertions, suite passed

Skipped checks and reasons: none beyond the N/A items above.

Risks and reviewer notes

  • 03_sandbox_timeout now reads back lifecycle.onTimeout after a create
    that omits autoPause, one that sets it, and a cold create that omits it.
    Asserting the field rather than waiting out a TTL keeps the suite fast and
    free of timing, and it covers both create paths. 15_volume.sh sends
    autoPause: false explicitly and is unaffected.
  • One unit test built its expired sandbox from Default and exercised the
    pause branch; it now names SandboxTimeoutAction::Pause.
  • e2e-tests (docker-compose) is red on 17_buildkit's
    test_concurrent_builds ("Timed out waiting for concurrent builders on
    different nodes"), which this branch does not touch — it changes a timeout
    action, not build scheduling. The same tree passed that job on an earlier run
    of this branch, and 17_buildkit is the suite behind the recent main
    failures too (runs 35551456023 and 35055252596; 6 of main's last 20
    Integration Tests runs are red). e2e-tests (single-node) passes here, and
    it runs the same suites. I cannot rerun a job from a fork.

Checklist

  • The PR contains one coherent change and no unrelated formatting or refactoring.
  • New behavior is covered by tests, or I explained why testing is impractical.
  • Logs and examples contain no credentials, tokens, or private registry information.
  • I did not manually edit generated code without updating its source and regenerating it.
    make agentenv-server on this spec produces exactly the three
    auto_pause: Some(false) constructors in the diff. It also reformats one unrelated
    block in models.rs — Node's FromStr, which cargo fmt collapses onto one line —
    and that hunk is left out to keep this to one change. Say the word if you would rather
    have the target's output verbatim.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/310 **Author:** [@nblintao](https://github.com/nblintao) **Created:** 9/21/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/auto-pause-default` --- ### 📝 Commits (1) - [`dc07100`](https://github.com/kvcache-ai/AgentENV/commit/dc071002e459886383f8178e533dd5ec0ae0e8a0) fix(api): default autoPause to false, matching the E2B API ### 📊 Changes **9 files changed** (+70 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `docs/src/concepts/sandboxes/auto-eviction.md` (+8 -8) 📝 `docs/src/concepts/sandboxes/index.md` (+1 -1) 📝 `scripts/tests/e2e/lib/helpers.sh` (+9 -0) 📝 `scripts/tests/e2e/suites/03_sandbox_timeout.sh` (+38 -1) 📝 `src/api/generated/src/models.rs` (+3 -3) 📝 `src/api/impls/sandbox.rs` (+4 -4) 📝 `src/api/openapi.yml` (+3 -3) 📝 `src/orchestrator/store/metadata.rs` (+1 -1) 📝 `src/orchestrator/tests.rs` (+3 -0) </details> ### 📄 Description ## What `autoPause` defaults to `false` on sandbox creation, as the schema documents and as E2B's API behaves. A create that does not mention it now deletes the sandbox at its timeout instead of pausing it. ## Why AgentENV's README offers the E2B SDK "without any code changes", and this is one default where the same code gets a different sandbox. - E2B defaults `autoPause` to `false` ([`spec/openapi.yml`][e2b-spec]); AgentENV carries the same field with the same description and `default: true` while the handlers read a missing value as a pause. - The SDKs never send the field unless the caller asks for a pause, by design: the Python SDK says sending `false` "would be indistinguishable from an explicit `"kill"` and would override the default the API owns", and documents the API's default to its users as `"kill"`. An implementation cannot rely on clients spelling `false` out. - `SandboxLifecycle` is byte-identical in both specs, so one unchanged create reports `onTimeout: "kill"` from E2B and `"pause"` here. - A pause nobody asked for is not free: it writes the sandbox's memory snapshot to the node's disk, and nothing reclaims it — `evict_expired_sandboxes` skips anything that is not `Running`, `cleanup_orphan_artifacts` keeps every artifact that still has a record, and the store has no quota. ## Related issue N/A — a spec-conformance fix; the divergence is visible in the two specs. ## Scope and non-goals Included: the two create handlers, the metadata default, the three create schemas and their generated constructors, the two docs pages that state the default, and e2e coverage of the mapping on both create paths. Excluded: `autoPauseMemory`, which AgentENV does not implement; any reclamation policy for sandboxes that are paused deliberately. ## Design and behavior changes - Both create handlers pause only on an explicit `autoPause: true`, and `Default for SandboxMetadata` follows. - Nothing else about pause, resume or eviction changes; an explicit `POST /sandboxes/{id}/pause` behaves as before. ## Compatibility and operations - Public API or generated protocol: the documented default changes value. The field, its type and its description are unchanged. - Configuration or defaults: **a create that omits `autoPause` now deletes at the timeout.** `autoPause: true` restores the previous behavior. Happy to gate this on a server-side configuration flag instead if you would rather not move the default in one step. - Snapshot manifest, artifact layout, or storage format: N/A. - Upgrade and rollback: no migration. Sandboxes already paused are untouched. - Host requirements, permissions, ports, or dependencies: N/A. ## Validation - [x] `make fmt` - [x] `make clippy` - [x] `make test-unit` - [x] Relevant Rust integration tests — `03_sandbox_timeout` covers the new default; run locally in compose mode, see below - [ ] `make -C services test` — N/A (`services/` untouched) - [x] Generated clients/server regenerated with the documented `make` target (`make agentenv-server`) - [x] Documentation updated - [ ] Benchmarks or performance comparison completed — N/A ```text cargo fmt --all -- --check # clean cargo clippy -- -D warnings # clean cargo test -p agentenv --lib # 896 passed make agentenv-server # the three constructors below, and nothing else SUITE_FILTER=03_sandbox_timeout.sh E2E_MODE=compose scripts/tests/e2e/run_e2e.sh # 14 assertions, suite passed ``` Skipped checks and reasons: none beyond the N/A items above. ## Risks and reviewer notes - `03_sandbox_timeout` now reads back `lifecycle.onTimeout` after a create that omits `autoPause`, one that sets it, and a cold create that omits it. Asserting the field rather than waiting out a TTL keeps the suite fast and free of timing, and it covers both create paths. `15_volume.sh` sends `autoPause: false` explicitly and is unaffected. - One unit test built its expired sandbox from `Default` and exercised the pause branch; it now names `SandboxTimeoutAction::Pause`. - `e2e-tests (docker-compose)` is red on `17_buildkit`'s `test_concurrent_builds` ("Timed out waiting for concurrent builders on different nodes"), which this branch does not touch — it changes a timeout action, not build scheduling. The same tree passed that job on an earlier run of this branch, and `17_buildkit` is the suite behind the recent `main` failures too (runs 35551456023 and 35055252596; 6 of `main`'s last 20 Integration Tests runs are red). `e2e-tests (single-node)` passes here, and it runs the same suites. I cannot rerun a job from a fork. ## Checklist - [x] The PR contains one coherent change and no unrelated formatting or refactoring. - [x] New behavior is covered by tests, or I explained why testing is impractical. - [x] Logs and examples contain no credentials, tokens, or private registry information. - [x] I did not manually edit generated code without updating its source and regenerating it. `make agentenv-server` on this spec produces exactly the three `auto_pause: Some(false)` constructors in the diff. It also reformats one unrelated block in `models.rs` — `Node`'s `FromStr`, which `cargo fmt` collapses onto one line — and that hunk is left out to keep this to one change. Say the word if you would rather have the target's output verbatim. [e2b-spec]: https://github.com/e2b-dev/infra/blob/main/spec/openapi.yml 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 14:22:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#337
No description provided.