Skip to content

v2 standalone session initialization requires undocumented OPENCODE_TEST_HOME inside a workspace-scoped sandbox #52759

Closed

Description

@SequeI

Description

OpenCode v2.0.22 cannot initialize a standalone session inside a macOS filesystem sandbox that permits the workspace and standard OpenCode directories but denies workspace parents and unrelated home directories.

Without environment overrides, the TUI fails during startup with HTTP 500. With OPENCODE_DISABLE_PROJECT_CONFIG=1, the TUI starts, but the first message fails with:

Session failed
Instruction initialization blocked by unavailable sources: core/instructions

The session works only after setting the undocumented test variable:

OPENCODE_DISABLE_PROJECT_CONFIG=1 \
OPENCODE_TEST_HOME="$PWD" \
opencode --standalone

A sandbox integration needs --standalone so the private server and tool execution remain inside the same sandbox. It needs a documented production mechanism for bounding configuration and instruction discovery without changing the real HOME.

This is related to #52290, but that report concerns Windows and an existing project without a filesystem sandbox. This report provides a deterministic macOS sandbox reproduction and an OPENCODE_TEST_HOME workaround.

Also related: #36837 and #36990.

Plugins

A nono sandbox integration plugin is installed. Nonfatal parent-directory probes were also observed with OPENCODE_PURE=1, although #36990 notes that v2 may not honor that variable consistently.

OpenCode version

2.0.22

Steps to reproduce

  1. Run OpenCode under a macOS Seatbelt sandbox that grants:

    • the current workspace
    • ~/.config/opencode
    • OpenCode cache, data, and state directories

    Deny the workspace parents and unrelated home directories.

  2. Run:

    opencode --standalone

    The TUI reports:

    UnknownError: An error occurred in Effect.tryPromise
    [cause]: ClientError: UnexpectedStatus: 500
    
  3. Run:

    OPENCODE_DISABLE_PROJECT_CONFIG=1 \
    opencode --standalone

    The TUI starts, but the first message fails with:

    Instruction initialization blocked by unavailable sources: core/instructions
    
  4. Run:

    OPENCODE_DISABLE_PROJECT_CONFIG=1 \
    OPENCODE_TEST_HOME="$PWD" \
    opencode --standalone

    The TUI and session work.

Screenshot and/or share link

The macOS sandbox attributes the attempted reads directly to the OpenCode process:

Sandbox: opencode deny file-read-data /Users
Sandbox: opencode deny file-read-data /Users/<user>
Sandbox: opencode deny file-read-data /Users/<user>/Work
Sandbox: opencode deny file-read-data /Users/<user>/.config
Sandbox: opencode deny file-read-data /System

Operating System

macOS 26.6.2

Terminal

iTerm2 with zsh

Activity

  1. added
    needs:complianceThis means the issue will auto-close after 2 hours.
    and removed
    needs:complianceThis means the issue will auto-close after 2 hours.
    on Oct 2, 2026
  2. github-actions commented on Oct 2, 2026

    @github-actions
    Contributor

    Thanks for updating the issue with a clear description and reproduction steps!

  3. zcutlip commented on Oct 18, 2026

    @zcutlip

    This is a blocker.

  4. neriousy commented on Oct 20, 2026

    @neriousy
    Member

    Thanks for the detailed sandbox reproduction! In 2.1.0, inaccessible discovery paths and ancestor instruction files are skipped during startup, addressing both the HTTP 500 and blocked first prompt without needing the OPENCODE_TEST_HOME workaround. Update with opencode upgrade or npm i -g @opencode/cli@latest (desktop: update the app). Please comment or reopen if your sandbox still blocks startup or the first message on 2.1.0.

  5. SequeI commented on Oct 20, 2026

    @SequeI
    Author

    Thanks a lot!

  6. zcutlip commented on Nov 12, 2026

    @zcutlip

    OpenCode is now working great with nono's sandbox profile. Thanks for the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions