[Enhancement]: Configurable Max Execution Timeout for Code Mode
Enhancement Category
Code mode improvements
Problem or Use Case
Currently, the execute_go_code tool in Code Mode has a hardcoded maximum execution timeout of 300 seconds (5 minutes). This is defined in internal/codemode/tooldesc.go.
While 5 minutes is sufficient for most tasks, there are legitimate workflows where an agent might need more time, such as:
- Analyzing a very large codebase.
- Running a complex migration or refactor that touches many files.
- Executing a long-running integration test suite.
- Waiting for external resources with slow responses.
When a task exceeds this limit, the execution is killed, and the user must try to manually break down the task or give up, interrupting the autonomous workflow.
Proposed Solution
Make the maximum execution timeout configurable.
- Configuration: Add a new configuration field (e.g.,
CodeMode.MaxTimeout) to the config.yaml or a CLI flag (e.g., --code-mode-max-timeout) to specify the upper limit for executionTimeout.
- Implementation:
- Update
internal/codemode/tooldesc.go to read this value dynamically instead of using the hardcoded 300.0.
- Pass the configuration context down to where the tool schema is generated.
- Default: Keep the default at 300 seconds to prevent accidental infinite loops for casual usage, but allow power users to increase it.
Alternatives Considered
- Hardcoding a higher limit: We could just bump it to 10 or 20 minutes, but "magic numbers" are generally bad, and any fixed limit will eventually be hit by someone. Configurable is better.
- Manual Chunking: Users can tell the AI to "do this in small batches", but this requires user intervention and awareness of the limit, defeating the purpose of an autonomous agent.
Impact Scope
Power users / advanced workflows
Additional Context
Relevant code location:
// internal/codemode/tooldesc.go
// - executionTimeout: integer (required, min 1, max 300) - Maximum execution time in seconds
minTimeout := 1.0
maxTimeout := 300.0
[Enhancement]: Configurable Max Execution Timeout for Code Mode
Enhancement Category
Code mode improvements
Problem or Use Case
Currently, the
execute_go_codetool in Code Mode has a hardcoded maximum execution timeout of 300 seconds (5 minutes). This is defined ininternal/codemode/tooldesc.go.While 5 minutes is sufficient for most tasks, there are legitimate workflows where an agent might need more time, such as:
When a task exceeds this limit, the execution is killed, and the user must try to manually break down the task or give up, interrupting the autonomous workflow.
Proposed Solution
Make the maximum execution timeout configurable.
CodeMode.MaxTimeout) to theconfig.yamlor a CLI flag (e.g.,--code-mode-max-timeout) to specify the upper limit forexecutionTimeout.internal/codemode/tooldesc.goto read this value dynamically instead of using the hardcoded300.0.Alternatives Considered
Impact Scope
Power users / advanced workflows
Additional Context
Relevant code location: