Skip to content

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

Closed as not planned

Description

@taxilian

Verification

  • I have verified that this issue has not already been suggested

Enhanced Capability Request

Description

Allow plugins to inject arbitrary environment variables into bash commands.

Use Case

My use case is in a plugin I use I can inject env vars (like AGENT_MODE, AGENT_ID) into bash commands via an optional env parameter on the bash tool. There are many plugins which want to do things like this, this would let any of them do it without requiring weird hacks or special extra features added to opencode.

This would allow a plugin to address #9292 and #15739, among others.

Other

Current Status

This capability is still needed. Current workarounds are causing issues and do not scale well.

The current workaround is to modify the command whenever a bash command is made and add the variable into the command; this can interfere with other features, though, and I've seen the agent get confused by it and start adding additional unneeded variables in for other commands, somehow thinking that it was needed. On three occasions I've seen the agent get confused and start using bad bash syntax as well.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 9, 2026
  2. github-actions commented on Apr 9, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review those issues before proceeding, as this appears to be a re-submission of #11065.

  3. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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