#8464: feat: make exec approval timeout configurable
docs
agents
stale
Cluster:
Error Handling in Agent Tools
## Summary
Add `tools.exec.approvalTimeoutSec` configuration option to control how long the system waits for an approval decision before timing out and denying a command. The default remains **120 seconds** for backward compatibility.
Previously this was hardcoded to 120 seconds and could not be changed without modifying the source code.
## Changes
- Add `approvalTimeoutSec` to `ExecToolConfig` type and zod schema
- Add resolve function to convert seconds to milliseconds
- Update `bash-tools.exec.ts` to use configured timeout
- Pass config through `pi-tools.ts`
- Update exec and exec-approvals docs
## Usage
```json5
{
tools: {
exec: {
approvalTimeoutSec: 300 // 5 minutes
}
}
}
```
Or via CLI:
```bash
openclaw config set tools.exec.approvalTimeoutSec 300
```
## Test Plan
- [x] Build passes (`pnpm build`)
- [x] Lint passes (`pnpm check`)
- [ ] Manual testing with different timeout values
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR adds a new `tools.exec.approvalTimeoutSec` configuration value (defaulting to 120s) and threads it through config types/zod schema and into `createExecTool`, replacing the previously hardcoded approval timeout for approval-gated exec flows. Docs were updated to mention the new setting.
Main code impact is in `src/agents/bash-tools.exec.ts`, where approval expiry (`expiresAtMs`), the timeout passed to `exec.approval.request`, and the request RPC timeout are now derived from config instead of constants.
<h3>Confidence Score: 4/5</h3>
- This PR is generally safe to merge; it’s a small, well-scoped config plumbing change with minor semantics to double-check around timeouts.
- Changes are localized and the new config is validated as a positive integer, reducing risk of invalid values. The main remaining concern is whether the derived request timeout (`approvalTimeoutMs + 10s`) matches intended UX for very small configured timeouts and whether the redundant flooring in the resolver is desired.
- src/agents/bash-tools.exec.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#11300: feat(exec): make shell configurable via tools.exec.shell
by imjszhang · 2026-02-07
80.3%
#21661: fix(agents): treat approval timeout as denial regardless of askFall...
by AI-Reviewer-QS · 2026-02-20
78.6%
#8332: fix: add per-tool-call timeout to prevent agent hangs (v2 - fixes m...
by vishaltandale00 · 2026-02-03
78.3%
#11854: fix: resolve per-agent tools.exec config in pi-tools
by Yida-Dev · 2026-02-08
76.3%
#14127: fix(exec): return command output when gateway approval is Always Allow
by Siziff · 2026-02-11
75.8%
#3872: improve bash-tools.exec.ts code quality
by Bestom927 · 2026-01-29
75.7%
#20435: fix(exec): prioritize user 'always allow' config over tool defaults...
by ChisomUma · 2026-02-18
75.4%
#23309: fix: remove 30-minute timeout for background exec sessions
by vksvikas · 2026-02-22
75.4%
#19684: fix: change elevatedDefault fallback from 'on' to 'off'
by neipor · 2026-02-18
73.7%
#15983: feat(exec): support env field in tools.exec config
by Imccccc · 2026-02-14
73.1%