mitsuhiko: No Silver Bullet for Agent Code Sandboxing
Around October 10, well-known developer mitsuhiko (author of essays such as "Abandoning Docker") laid out his concerns about code sandbox isolation while discussing implementations of codemode—having agents generate and execute code. On October 12 he concluded that there is no silver bullet for agent sandboxes: VMs, sandboxes, durable objects, and even a JavaScript interpreter each have scenarios where they are optimal, and no one-size-fits-all solution exists.
Confirmed
- mitsuhiko said he initially rejected a shared-process codemode approach (not using QuickJS) due to its complexity and lack of proper isolation; he considers the route reasonable but not one he would trust himself.
- His core argument draws on years of maintaining jinja2/minijinja: such engines are inherently unsafe with fully untrusted input unless an OS-level isolation boundary sits in between—explaining why he finds shared workers insufficient.
- In a discussion with Dev Agrawal, he demonstrated practically that with only basic isolation and multiple calls sharing one worker, an infinite loop can exhaust memory and take the machine down.
- He added that opencode's trade-off of using an AST interpreter for code execution is acceptable, but he would not start from that route if building Pi from scratch today; he is also skeptical of relying solely on wasm/worker isolation.
- Developer thdxr explained that his team deliberately avoided QuickJS in their codemode implementation: it introduces wasm complexity, forces worker threads, and requires serializing data between the main thread and workers, and he suggested others implementing similar features look at their approach.
Why it matters
- As agents generating and executing code becomes mainstream, sandbox reliability directly defines the security boundary. mitsuhiko's position represents the cautious camp: no single isolation mechanism should be trusted absolutely, and implementers must make explicit trade-offs between complexity and isolation strength, combining boundaries as the scenario demands.
2026-10-10 ~ 2026-10-12 · 9 related posts
Primary sources
- mitsuhiko: No one-size-fits-all sandbox for agents — VMs, sandboxes, durable objects each have their place — mitsuhiko ·
- mitsuhiko demos why sharing one worker for AI agent code execution ends in OOM kills — mitsuhiko ·
- mitsuhiko: template engines like jinja2 are unsafe for untrusted input without OS-level isolation — mitsuhiko ·
- Why this team skipped QuickJS for codemode: wasm complexity, worker threads, serialization — cravenceiling · 2026-10-10
- mitsuhiko: an AST interpreter alone is too fragile as an agent code-execution sandbox — mitsuhiko · 2026-10-10
- mitsuhiko: opencode's isolation tradeoff is fine, but he wouldn't start there with Pi — mitsuhiko · 2026-10-10
- mitsuhiko on codemode: reasonable approach, but poor isolation kept him away — mitsuhiko · 2026-10-10
- mitsuhiko: sharing a worker without OS-level isolation is unsafe for agent codemode — mitsuhiko · 2026-10-10
- [source] mitsuhiko: template engines like jinja2 are unsafe for untrusted input without OS-level isolation — mitsuhiko · 2026-10-10
- [source] mitsuhiko demos why sharing one worker for AI agent code execution ends in OOM kills — mitsuhiko · 2026-10-10
- [source] mitsuhiko: No one-size-fits-all sandbox for agents — VMs, sandboxes, durable objects each have their place — mitsuhiko · 2026-10-12
1 near-duplicate retellings: mitsuhiko