anomalyco / anomalyco/opencode
cli: Bun managed-service spawn drops runtime conditions
@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
- Run the V2 CLI from source when it needs to start a managed service.
- 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
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.
Assessment
This issue has not been assessed yet.