anomalyco / anomalyco/opencode
V2 Bash tool does not apply plugin shell.env hooks
@kitlangton is already working on this.
Since Aug 7, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
The V2 Bash tool launches child processes without applying plugin-provided shell.env values. The legacy shell implementation calls plugin.trigger("shell.env", { cwd, sessionID, callID }, { env: {} }), while packages/core/src/tool/bash.ts launches ChildProcess.make(...) directly and contains a TODO for this missing behavior.
This breaks plugins that provide invocation-scoped environment variables to shell commands.
Reproduction
- Configure a local plugin with a
shell.envhook that setsOPENCODE_SHELL_ENV_PROBE=present. - Start OpenCode V2 with that plugin loaded.
- Ask the Bash tool to run
printenv OPENCODE_SHELL_ENV_PROBE. - Observe that the variable is absent.
Expected behavior
V2 Bash should invoke the same shell.env plugin contract with the active cwd, sessionID, and callID, then merge the returned values into the child process environment. Concurrent sessions must retain invocation-scoped isolation.
Version
Observed with OpenCode 1.18.4.
AI assistance: OpenAI gpt-5.6-sol via OpenCode inspected the runtime behavior and source paths and drafted this report. Chris Huber verified the reproduction and remains responsible for the report.
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.