← Back to PRs

#16342: fix(nodes-tool): use invokeTimeoutMs for HTTP timeout in invoke action

by xiaoyaner0201 open 2026-02-14 17:07 View on GitHub →
agents stale size: S
## 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