anomalyco / anomalyco/opencode

cli: Bun managed-service spawn drops runtime conditions

Open
#41,324 0 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 8, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

On V2 source builds, starting or replacing the managed background service can fail even though the original CLI starts correctly.

The development CLI runs with --conditions=browser. However, selfCommand() reconstructs the Bun child command as:

[process.execPath, entrypoint]

ServiceConfig then appends serve --service. The child therefore loses --conditions=browser and exits before registering.

Running the child directly without the condition fails deterministically:

error: Cannot find module 'react/jsx-dev-runtime' from
'packages/tui/src/config/v1/index.tsx'

Running the same command with --conditions=browser starts the service successfully.

Plugins

None

OpenCode version

V2 branch at f43f2b354c152b1a167dd6b03afc64d1987599b1

Steps to reproduce
  1. Run the V2 CLI from source when it needs to start a managed service.
  2. The spawned service exits before registration.

The generated child command fails:

bun packages/cli/src/index.ts serve --service

Error:

Cannot find module 'react/jsx-dev-runtime'

The same command succeeds with the original runtime condition:

bun run --cwd packages/cli --conditions=browser src/index.ts serve --service

selfCommand() drops --conditions=browser when reconstructing the Bun command.

Screenshot and/or share link

No response

Operating System

macOS, arm64

Terminal

Apple_Terminal

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.