nanocoder icon indicating copy to clipboard operation
nanocoder copied to clipboard

[Feature] Optional timeout parameter for execute_bash

Open akramcodez opened this issue 3 weeks ago • 1 comments

Description

Add an optional timeout parameter to execute_bash so the model can allow long builds and tests, or cut short commands that should be quick.

Use Case

The tool description says commands time out after 2 minutes, and the schema (source/tools/execute-bash.tsx) only has command and description. A full test suite, a Docker build or a large install regularly needs more than 2 minutes, and the model has no way to ask for it. It then re-runs the command, gets killed again, and either loops or gives up. The opposite also happens: a command that should return in seconds (a curl against a hung host) blocks the turn for the full 2 minutes.

Proposed Solution

Add timeout_seconds (integer) to the schema. Clamp it between 1 second and the existing hard ceiling (TIMEOUT_EXECUTION_MAX_MS, 5 minutes), keep 2 minutes as the default, and mention the limit that was applied in the result when a command is killed ("timed out after N seconds") so the model knows whether to raise it. The approval preview should show a non-default timeout.

Alternatives Considered

Telling the model to append timeout 600 ... to commands: not portable (macOS has no timeout), and the sandbox and process-tree cleanup do not know about it. Running everything in the background (#1974) is a bigger change and does not replace a simple per-call limit.

Additional Context

  • [x] I have searched existing issues to ensure this is not a duplicate
  • [x] This feature aligns with the project's goals (local-first AI assistance)

Implementation Notes (optional)

bashExecutor.execute already accepts {timeoutMs} (source/services/bash-executor.ts), and executeBashCommand forwards options, so the main work is the schema, clamping and the message.

akramcodez avatar Nov 10 '26 08:11 akramcodez

@akramcodez @addyCooks Hey! I'd like to work on this issue and contribute a fix.

Could you please assign this issue to me? I'll submit a PR with the changes.

Thanks!

shravanramakunja avatar Nov 11 '26 04:11 shravanramakunja