Skip to content

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

Closed

Description

@nabilfreeman

Summary

The shell tool's description text advertises a hardcoded 120000ms (2 minutes) default timeout to the model, regardless of the runtime value of DEFAULT_TIMEOUT (which respects OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS). This trains LLMs to override operator-configured defaults with their own (often shorter) explicit timeout values, causing premature SIGTERM on long-running commands.

Current behavior

In packages/opencode/src/tool/shell/prompt.ts, the per-shell description sections (bashCommandSection, powershellCommandSection, cmdCommandSection) each hardcode this line verbatim:

You can specify an optional timeout in milliseconds. If not specified, commands will time out after 120000ms (2 minutes).

Meanwhile, the actual runtime default is computed at packages/opencode/src/tool/shell.ts:29:

const DEFAULT_TIMEOUT = Flag.OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS || 2 * 60 * 1000

When an operator sets e.g. OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS=7200000 (2 hours), the model still reads "2 minutes" in its tool description and frequently emits explicit timeout values clustered around its mental model of "2 minutes" — defeating the operator's intent. Combined with the params.timeout ?? DEFAULT_TIMEOUT fallback at shell.ts:603, any LLM-supplied value wins.

Expected behavior

The advertised default in the tool description should reflect the actual runtime DEFAULT_TIMEOUT value, so the model is told the truth about how long it has before SIGTERM.

Suggested fix

shell.ts:588 already calls ShellPrompt.render(name, process.platform, limits), where limits: Limits is plumbed through to the command-section helpers. Two small mechanical changes close the gap:

  1. Extend the Limits type in prompt.ts to include defaultTimeoutMs: number (or pass DEFAULT_TIMEOUT as a separate fourth argument to render).
  2. Replace the hardcoded 120000ms (2 minutes) literal in bashCommandSection, powershellCommandSection, and cmdCommandSection with ${limits.defaultTimeoutMs}ms (or a similar interpolation that reflects the actual configured value).

A PR will follow.

Environment

  • Affected files: packages/opencode/src/tool/shell/prompt.ts (three call sites), packages/opencode/src/tool/shell.ts:29,588,603
  • Reproducible on: latest dev

Activity

  1. nabilfreeman commented on May 23, 2026

    @nabilfreeman
    ContributorAuthor

    Hey @jlongster, bumping you on this issue and the related pull request

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