Skip to content

Conversation

@taxilian
Copy link

Fixes #11065

Adds optional env parameter to the bash tool that allows plugins to inject environment variables into spawned processes.

Changes:

  • Added env: z.record(z.string(), z.string()).optional() to bash tool schema
  • Merged env vars with process.env in spawn call
  • Added tests for single and multiple environment variables

Verified:

  • All tests pass including new env tests
  • Tested with a plugin using tool.execute.before hook to set env vars

Add optional `env` parameter to the bash tool that allows passing
environment variables to the spawned process. This enables plugins
to inject environment variables like AGENT_MODE and AGENT_ID to
track whether commands are running in primary or subagent sessions.

Changes:
- Add `env` parameter to bash tool schema (z.record(z.string(), z.string()))
- Merge env vars with process.env in spawn call
- Add tests for single and multiple environment variables
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

Add documentation for the optional env parameter that allows setting
environment variables for bash commands.
@ariane-emory
Copy link
Contributor

ariane-emory commented Jan 29, 2026

This seems like a good idea. I can imagine how the feature could be useful. Have not personally tested yet, but the PR looks pretty clean, LGTM.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(bash): add env parameter for setting environment variables

2 participants