fix(shell): advertise actual default timeout in tool description#25917
Open
nabilfreeman wants to merge 3 commits intoanomalyco:devfrom
Open
fix(shell): advertise actual default timeout in tool description#25917nabilfreeman wants to merge 3 commits intoanomalyco:devfrom
nabilfreeman wants to merge 3 commits intoanomalyco:devfrom
Conversation
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
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #25913
Type of change
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 setOPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MSto override the runtime default, the description still says 2 minutes — so models read that, emit short explicittimeoutvalues, and override your configured default. Long-running commands get SIGTERMed prematurely.The fix plumbs
DEFAULT_TIMEOUTthrough the existingLimitstype the same waymaxLinesandmaxBytesare already passed:defaultTimeoutMs: numbertoLimitsinprompt.ts.render()call site inshell.ts:{ ...limits, defaultTimeoutMs: DEFAULT_TIMEOUT }. Inline rather than intrunc.limits()becauseTruncateshouldn't have to know about timeouts.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 typecheckpasses. All shell-related tests pass (test/shell/,test/tool/shell.test.ts,test/pty/pty-shell.test.ts). Ranbun test --timeout 30000frompackages/opencode/with and without my changes — same 121 pre-existing failures ondeveither way, zero new ones introduced.Screenshots / recordings
N/A — text-only change in a tool description.
Checklist