Repository navigation
Description
User Story
I use OpenShell to contain AI agents that run as short, frequent jobs: one sandbox per agent run, each doing well under a second of work.
I directly encountered sandbox deletion taking most of each run's time.
This affects whether OpenShell is practical for high-frequency agent workloads without moving them to another runtime.
Problem Statement
On the Docker driver, openshell sandbox delete blocks for about 5.4 s for a sandbox whose only command has already finished. Over 10 runs the delete command took 5.37 s at p50 (p95 5.41 s, max 5.43 s), a spread of about 0.1 s. Delete accounts for about 77% of a create, exec and delete cycle of 7.66 s, while the command itself takes 0.25 s.
sandbox delete --help and sandbox stop --help offer no timeout or force option, and I found no gateway or global setting for it.
An OpenShell contributor reviewing main at 438e07b reports the Docker driver's stop timeout defaults to 10 s (crates/openshell-core/src/config.rs:61).
Related: #6144 (slow delete on rootless Podman), #3804 (idle stop and deletion timeouts), #5873 (fast start for bursty workloads).
Impact / Why This Matters
When this happens, users running one sandbox per job pay over 5 s of teardown per job, for a sandbox whose work is already done.
This results in long batch times: a pass of 910 agent runs takes about 1.9 hours one at a time, about 1.5 hours of it deleting sandboxes. To get usable throughput I moved my no-network zones to another runtime, which meant giving up OpenShell's per-path read allow-lists for them.
This matters because the workloads that most need one isolated sandbox per task (agents handling sensitive data) also run often and briefly, so teardown cost decides whether OpenShell is practical for them.
Acceptance Criteria
- Deleting a sandbox whose processes have exited completes in about 1 s or less on the Docker driver, or
- the stop timeout can be set per sandbox or per gateway, and the setting is documented.
Reproduction Steps
-
Use a minimal policy (read_only: /usr/bin/bash, /usr/lib/x86_64-linux-gnu, /tmp; no network_policies; Landlock hard_requirement).
-
Repeat 10 times, one sandbox at a time, timing each command:
openshell sandbox create --name repro-tNN --from <IMAGE> --policy policy-a.yaml --detach --no-auto-providers --no-tty openshell sandbox exec --name repro-tNN --no-tty --no-login-shell --timeout 60 -- /usr/bin/bash -c true openshell sandbox delete repro-tNN -
Results (seconds, n = 10, all runs succeeded):
phase p50 p95 max create (until Ready) 1.51 1.56 1.57 exec 0.25 0.25 0.25 delete command 5.37 5.41 5.43 total cycle 7.66 7.79 7.81 After
deletereturns, the sandbox is gone fromopenshell sandbox list --namesat the next check.
Expected: deleting a sandbox with no running work completes in about a second.
Actual: sandbox delete blocks for about 5.4 s every time, and no option shortens it.
Suggested UX (if applicable)
Notional only:
openshell sandbox delete NAME --timeout 0 # or --force, for sandboxes with no running work
-- gateway config
docker:
stop_timeout_secs: 1
Environment
- OpenShell: 0.1.7 (not retested on main)
- OS: Ubuntu 26.04.1 LTS, sandbox image based on Debian 13 (trixie)
- CPU: Intel Core i7-12650H, 10 cores, 16 threads
- Deployment: Docker driver, gateway as a systemd user unit, Landlock compatibility hard_requirement
Activity
michaelmanly commentedon Dec 4, 2026
@bayesianHimanshu
5 seconds of teardown for a sub-second job is rough. Would reusing isolated workers between jobs be an option?