Skip to content

fix(shell): advertise actual default timeout in tool description#25917

Open
nabilfreeman wants to merge 3 commits intoanomalyco:devfrom
nabilfreeman:fix-shell-default-timeout-advertising
Open

fix(shell): advertise actual default timeout in tool description#25917
nabilfreeman wants to merge 3 commits intoanomalyco:devfrom
nabilfreeman:fix-shell-default-timeout-advertising

Conversation

@nabilfreeman
Copy link
Copy Markdown

@nabilfreeman nabilfreeman commented May 5, 2026

Issue for this PR

Closes #25913

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The shell tool's description text hardcodes "120000ms (2 minutes)" in three places (the bash, powershell, and cmd command sections in packages/opencode/src/tool/shell/prompt.ts). When you set OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS to override the runtime default, the description still says 2 minutes — so models read that, emit short explicit timeout values, and override your configured default. Long-running commands get SIGTERMed prematurely.

The fix plumbs DEFAULT_TIMEOUT through the existing Limits type the same way maxLines and maxBytes are already passed:

  1. Add defaultTimeoutMs: number to Limits in prompt.ts.
  2. Spread it in at the render() call site in shell.ts: { ...limits, defaultTimeoutMs: DEFAULT_TIMEOUT }. Inline rather than in trunc.limits() because Truncate shouldn't have to know about timeouts.
  3. Replace the literal 120000ms (2 minutes) in the three command sections with ${limits.defaultTimeoutMs}ms.

When the env var is unset the description still renders 120000ms. When set, it shows the actual configured value.

How did you verify your code works?

bun turbo typecheck passes. All shell-related tests pass (test/shell/, test/tool/shell.test.ts, test/pty/pty-shell.test.ts). Ran bun test --timeout 30000 from packages/opencode/ with and without my changes — same 121 pre-existing failures on dev either way, zero new ones introduced.

Screenshots / recordings

N/A — text-only change in a tool description.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The shell tool description hardcoded "120000ms (2 minutes)" in three
places (bash, powershell, cmd command sections), even when
OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS overrides the default
at runtime. Models read this hardcoded text and frequently emit
explicit timeouts that override the operator-configured default.

Plumb DEFAULT_TIMEOUT through the existing Limits type (matching the
${limits.maxLines} / ${limits.maxBytes} interpolation pattern) so
the rendered description reflects the real default.

Closes anomalyco#25913
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels May 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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.

shell tool description advertises hardcoded 2-minute default, even when OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS is set

1 participant