fix(sandbox): agent adapter fails with '/unknown/<entrypoint>' when a sandbox is mounted
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 4.6k
- Forks
- 251
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 34
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with secure-exec/crates/execution/src/javascript.rs and secure-exec/crates/sidecar/src/package_projection.rs, then trace AGENTOS_GUEST_PATH_MAPPINGS for sandboxed VMs. Run the examples/quickstart/sandbox repro and inspect packages/core/tests/sandbox-integration.test.ts. Done means sandbox agent createSession plus prompt succeeds with the adapter resolving under /opt/agentos, with integration coverage guarding it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, rust, typescript
- Domain
- infrastructure, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100