#16342: fix(nodes-tool): use invokeTimeoutMs for HTTP timeout in invoke action
agents
stale
size: S
Cluster:
Timeouts and Memory Management Fixes
## Problem
When `invokeTimeoutMs` is provided for a `nodes invoke` call, the HTTP request to the gateway still uses the default gateway timeout. This causes premature HTTP cancellation for long-running node operations.
For example, a VS Code extension node running Cursor Agent CLI tasks can take 3+ minutes, but the HTTP layer times out much earlier (default ~30s), causing the invoke to fail even though the node is still processing.
## Fix
When `invokeTimeoutMs` is provided, set the HTTP timeout to `invokeTimeoutMs + 5s`, ensuring the HTTP layer doesn't cancel before the gateway has a chance to forward the response.
## Changes
- `src/agents/tools/nodes-tool.ts`: 5 lines added in the `invoke` action handler
## Context
Discovered while building [openclaw-vscode](https://github.com/xiaoyaner-home/openclaw-vscode), a VS Code/Cursor extension that connects to the Gateway as a Node with 40+ IDE commands including Cursor Agent CLI integration.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added HTTP timeout buffer to prevent premature cancellation when `invokeTimeoutMs` is specified for `nodes invoke` and `run` actions. The HTTP layer now waits `invokeTimeoutMs + 5s` instead of using the default 30s timeout, ensuring long-running node operations can complete without HTTP timeout errors.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The fix follows an established pattern used elsewhere in the codebase (e.g., `exec.approval.request` at src/agents/tools/nodes-tool.ts:482 and `sessions-send-tool.ts:346`). The 5-second buffer is consistent with the existing approval timeout handling and provides adequate headroom for the HTTP layer without introducing significant delays. The change is minimal, well-scoped, and addresses a genuine bug where HTTP timeouts would cancel valid long-running operations.
- No files require special attention
<sub>Last reviewed commit: bbbf741</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#12477: fix(agents): prevent TimeoutOverflowWarning when timeout is disabled
by skylarkoo7 · 2026-02-09
75.4%
#9114: Fix: Reduce NO_TIMEOUT_MS to 24 days to avoid Node.js overflow warning
by vishaltandale00 · 2026-02-04
74.0%
#10636: fix: setTimeout integer overflow causing server crash
by devmangel · 2026-02-06
73.6%
#11416: fix: clamp timeout values to avoid 32-bit overflow warning
by seojoonkim · 2026-02-07
71.3%
#9178: Fix: GatewayClient queueConnect() setTimeout never fires
by vishaltandale00 · 2026-02-04
71.1%
#23745: fix(resilience): add timeout to unguarded fetch calls in browser su...
by kevinWangSheng · 2026-02-22
70.4%
#20014: fix(nodes): use formatExecCommand for approval request command text
by openperf · 2026-02-18
70.1%
#22719: fix(agents): make subagent announce timeout configurable (restore 6...
by Valadon · 2026-02-21
69.8%
#22355: fix(gateway): add exponential backoff to remote node bin probes
by xinhuagu · 2026-02-21
69.7%
#6466: fix(gateway): add handshake timeout and connection error handling
by jarvis-raven · 2026-02-01
69.4%