1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! `koda-sandbox-stage2` — in-sandbox helper that runs after
//! `bwrap --unshare-net` strips host networking, before the user
//! command (Phase 3c.1.c of #934).
//!
//! See `koda_sandbox::stage2` (Linux-only module) for the architecture
//! diagram and the full lifecycle. This file is just the binary shim.
//!
//! ## Why a separate binary, not a flag on the main `koda` binary
//!
//! - **Tiny binary.** Stage 2 doesn't link tokio, the LLM client, the
//! TUI, MCP, etc. — just std + libc. Faster startup, smaller
//! memory, smaller bind-mount footprint.
//! - **Same precedent as `koda-fs-worker`.** koda-sandbox already
//! ships one helper binary and the discovery story (`current_exe`
//! sibling lookup, `KODA_FS_WORKER_BIN` override) is a known
//! pattern. This is just one more.
//! - **Test isolation.** Cargo sets `CARGO_BIN_EXE_koda-sandbox-stage2`
//! for integration tests, so e2e tests can find the binary without
//! knowing the install path.