Summary
createSession(<agent>) fails when the VM is created with sandbox: { provider: docker() }. The agent adapter boots in V8 but its module identity resolves to /unknown/<acpEntrypoint> instead of /opt/agentos/bin/<acpEntrypoint>, so its internal require fails and the adapter process exits before initialize.
Reproduced with the examples/quickstart/sandbox quickstart (pi + docker sandbox):
ACP adapter process acp-agent-1 exited with code 1 before response id=1;
adapter_stderr="Error: Cannot find module '/unknown/pi-sdk-acp'
at /unknown/pi-sdk-acp:236:1"
Isolation
| Scenario |
Result |
pi-sdk-boot-probe (pi SDK boots in VM) |
pass |
pi-headless (plain createSession('pi') + prompt e2e) |
pass |
sandbox + pi createSession (the quickstart's path) |
fail — /unknown/pi-sdk-acp |
The VM itself is created fine (the docker mount + process bindings attach without error); only the agent adapter's guest path is wrong.
Root cause
secure-exec/crates/execution/src/javascript.rs → host_to_guest_string iterates self.mappings first and otherwise falls through to /unknown/<basename>. Under a sandboxed VM there is no guest-path mapping covering the /opt/agentos package projection (secure-exec/crates/sidecar/src/package_projection.rs, OPT_AGENTOS_ROOT = /opt/agentos), so the adapter's host path hits the /unknown/ fallback. In plain (non-sandbox) mode that mapping is present, which is why the plain agent tests pass.
The sidecar's AGENTOS_GUEST_PATH_MAPPINGS assembly for a sandboxed VM needs to include the /opt/agentos projection (and the projected agent package host dirs) so host_to_guest_string maps the adapter to /opt/agentos/bin/<acpEntrypoint>.
Test gap
The only sandbox integration test (packages/core/tests/sandbox-integration.test.ts) exercises software: [common] + writeFile/readFile — it never starts an agent session. Add coverage for sandbox + agent createSession + prompt so this path is guarded.
Repro
examples/quickstart/sandbox: npx tsx index.ts # Docker + ANTHROPIC_API_KEY
Summary
createSession(<agent>)fails when the VM is created withsandbox: { provider: docker() }. The agent adapter boots in V8 but its module identity resolves to/unknown/<acpEntrypoint>instead of/opt/agentos/bin/<acpEntrypoint>, so its internalrequirefails and the adapter process exits beforeinitialize.Reproduced with the
examples/quickstart/sandboxquickstart (pi + docker sandbox):Isolation
pi-sdk-boot-probe(pi SDK boots in VM)pi-headless(plaincreateSession('pi')+ prompt e2e)createSession(the quickstart's path)/unknown/pi-sdk-acpThe VM itself is created fine (the docker mount + process bindings attach without error); only the agent adapter's guest path is wrong.
Root cause
secure-exec/crates/execution/src/javascript.rs→host_to_guest_stringiteratesself.mappingsfirst and otherwise falls through to/unknown/<basename>. Under a sandboxed VM there is no guest-path mapping covering the/opt/agentospackage projection (secure-exec/crates/sidecar/src/package_projection.rs,OPT_AGENTOS_ROOT = /opt/agentos), so the adapter's host path hits the/unknown/fallback. In plain (non-sandbox) mode that mapping is present, which is why the plain agent tests pass.The sidecar's
AGENTOS_GUEST_PATH_MAPPINGSassembly for a sandboxed VM needs to include the/opt/agentosprojection (and the projected agent package host dirs) sohost_to_guest_stringmaps the adapter to/opt/agentos/bin/<acpEntrypoint>.Test gap
The only sandbox integration test (
packages/core/tests/sandbox-integration.test.ts) exercisessoftware: [common]+writeFile/readFile— it never starts an agent session. Add coverage for sandbox + agentcreateSession+ prompt so this path is guarded.Repro