Repository navigation
feat(cli): add --rpc-timeout and cancel tool calls on timeout - #3639
Open
flavio-cesar wants to merge 4 commits into
Open
flavio-cesar wants to merge 4 commits into
flavio-cesar wants to merge 4 commits into
Conversation
flavio-cesar
force-pushed
the
feat/cli-rpc-timeout-3604
branch
from
November 26, 2026 14:04
5412981 to
9c222a5
Compare
yulunz
approved these changes
Nov 30, 2026
yulunz
left a comment
Collaborator
There was a problem hiding this comment.
This changes what --timeout does for CLI users: since #3443 (shipped in 1.14.0), wait_for --timeout=300000 made the CLI wait, but now the CLI cancels the call at 180s unless --rpc-timeout is passed too. The release notes only use the commit subject, so could the title say so? For example:
feat(cli): add --rpc-timeout; tool --timeout no longer extends the CLI wait
| : ''; | ||
| reject( | ||
| new Error( | ||
| `Timeout waiting for daemon response after ${timeout}ms${hint}`, |
Collaborator
There was a problem hiding this comment.
nit: Since users pass --rpc-timeout as 90s/5m, it might read better to report seconds here (after 300s) instead of after 300000ms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3604
Tools without a
timeoutargument, such aslighthouse_auditand the heap snapshot tools, were cut off by the CLI after 60s. The daemon kept working, but the result was lost. Following the direction in the issue, the CLI now has its own--rpc-timeout, waits 180s by default, and cancels the tool call when the time runs out.User-visible changes:
--rpc-timeout(for example90s,5mor1h) sets how long the CLI waits for a tool call. The default is 180s instead of 60s.start,statusandstopdo not take this option, andstatusandstopstill wait up to 60s for a response.--rpc-timeoutis now an option on every tool command. To pass it as literal text, put it after--.--timeoutno longer changes how long the CLI waits. This replaces the behavior from fix: respect tool timeouts in CLI daemon responses #3443. With a--timeoutclose to or above 180s, you now also need a longer--rpc-timeout.--rpc-timeout.--rpc-timeout=30s), the daemon no longer drops that connection on its own. On main, the abandoned call dropped it after 60s. A call that waits the full 60s still drops it.--idleTimeout, a cancelled call no longer counts as activity, so the daemon can exit while the cancelled handler is still running. As on main, the daemon cannot finish exiting while a browser connection attempt is stuck.docs/cli.mdand the CLI skill describe the new option.Tests:
callToolforwards the signal. CLI tests cover the 180s default, the option before and after the command, invalid values, and that a tool's--timeoutdoes not change the limit.pwa.test.tsand 1 inscreenshot.test.ts). The same 5 tests fail on main in that environment. The daemon status test that uses port 9222 was left out and passed separately with another port.npm run genmade no changes.daemon/client.test.tsalso passed. The copy used a closed local browser endpoint and a port other than 9222.lighthouse_auditran three times on each version. Only one pair is comparable: the same 10,000-block local page, one version at a time. On main, the CLI exited with the timeout error after 61s and the reports appeared later. With this change, it printed the audit after 84s. When both versions ran at the same time on that page, main timed out after 62s, and with this change Lighthouse returned its ownPROTOCOL_TIMEOUTerror after 144s. On a lighter page, both finished (52s on main, 82s with this change). Other jobs were running on the machine, so those times are not a speed comparison. These runs were before the last round of changes.