Description
Long-running bash commands with verbose output are being truncated and/or timed out, causing agents to re-attempt commands instead of polling the saved tool output. This creates serious idempotency issues in workflows where commands should run to completion.
Current behavior:
- Bash commands have a hardcoded 2-minute default timeout (
src/tool/bash.ts:21)
- Output is truncated at 2,000 lines or 50KB (
src/tool/truncation.ts:10-11)
- When output is truncated, full output is saved to
~/.opencode/data/tool-output/, but agents frequently re-run the command instead of reading the saved output
- Commands are killed after timeout, even if they would have completed successfully
The problem:
- Commands that produce large build logs, test outputs, or verbose diagnostics get truncated
- Agents see truncated output and often retry the command instead of using
Read with offset/limit on the saved output file
- This creates duplicate work, wasted API calls, and potential side effects from non-idempotent commands
- For CI/CD workflows, this behavior is unacceptable - commands should never exit until a proper exit code is received
Current configuration options:
OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS - env var for timeout (exists)
- No configuration for
MAX_LINES or MAX_BYTES truncation limits (hardcoded)
Proposed solution:
Add opencode.json configuration for these limits:
This would allow users to configure behavior appropriate for their workflows without needing environment variables.
Plugins
None
OpenCode version
Current (main branch)
Steps to reproduce
- Run a command that produces more than 2,000 lines of output (e.g.,
npm install with verbose logging, large test suite)
- Observe output is truncated with message about saved file
- Watch agent retry the command instead of reading the saved output
- For timeout: run any command that takes longer than 2 minutes
Screenshot and/or share link
No response
Operating System
macOS
Terminal
No response
Description
Long-running bash commands with verbose output are being truncated and/or timed out, causing agents to re-attempt commands instead of polling the saved tool output. This creates serious idempotency issues in workflows where commands should run to completion.
Current behavior:
src/tool/bash.ts:21)src/tool/truncation.ts:10-11)~/.opencode/data/tool-output/, but agents frequently re-run the command instead of reading the saved outputThe problem:
Readwith offset/limit on the saved output fileCurrent configuration options:
OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS- env var for timeout (exists)MAX_LINESorMAX_BYTEStruncation limits (hardcoded)Proposed solution:
Add
opencode.jsonconfiguration for these limits:{ "experimental": { "bash": { "timeout_ms": 600000, // 10 minutes "max_lines": 10000, // or null to disable "max_bytes": 512000 // or null to disable } } }This would allow users to configure behavior appropriate for their workflows without needing environment variables.
Plugins
None
OpenCode version
Current (main branch)
Steps to reproduce
npm installwith verbose logging, large test suite)Screenshot and/or share link
No response
Operating System
macOS
Terminal
No response