-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization
Description
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
Readwith 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_LINESorMAX_BYTEStruncation 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 installwith 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
perfIndicates a performance issue or need for optimizationIndicates a performance issue or need for optimization
{ "experimental": { "bash": { "timeout_ms": 600000, // 10 minutes "max_lines": 10000, // or null to disable "max_bytes": 512000 // or null to disable } } }