Skip to content

fix(sandbox): agent adapter fails with '/unknown/<entrypoint>' when a sandbox is mounted #1611

Description

@NathanFlurry

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.rshost_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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions