Skip to content

fix(opencode): support dynamic bash timeout via OPENCODE_BASH_TIMEOUT env var#12921

Open
Mr-Neutr0n wants to merge 1 commit intoanomalyco:devfrom
Mr-Neutr0n:fix/bash-timeout-env-var-v2
Open

fix(opencode): support dynamic bash timeout via OPENCODE_BASH_TIMEOUT env var#12921
Mr-Neutr0n wants to merge 1 commit intoanomalyco:devfrom
Mr-Neutr0n:fix/bash-timeout-env-var-v2

Conversation

@Mr-Neutr0n
Copy link
Copy Markdown

Summary

  • Change OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS from a static const (evaluated once at module load) to a dynamic getter via Object.defineProperty, so the env var is read at access time
  • Update bash.ts to use a getDefaultTimeout() function instead of the static DEFAULT_TIMEOUT constant

Closes #12762

Test plan

  • Set OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS=5000 before launching opencode, verify bash commands time out after 5 seconds
  • Verify default 2-minute timeout still applies when the env var is unset
  • Verify invalid values (negative, non-integer, non-numeric) are ignored and the default timeout is used

… env var

Change OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS from a static
module-load-time constant to a dynamic getter so the env var is read
at access time instead of import time. This allows the timeout to be
changed at runtime without restarting the process.

Closes anomalyco#12762
@github-actions
Copy link
Copy Markdown
Contributor

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

No duplicate PRs found

@MoriNo23
Copy link
Copy Markdown

This PR would be very helpful for users with slower machines. I often work on low-spec hardware where compilation and command execution take longer than the default 2-minute timeout, causing builds and long-running commands to be cancelled prematurely. Having this environment variable working properly would allow us to adjust the timeout based on our hardware capabilities. Thanks for working on this fix!

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.

OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS is being ignored

2 participants