Repository navigation
Conversation
|
Found a platform gap in the new deadline-test fixture at On Linux with I reproduced this using the actual client/utils source in an isolated harness on Node 24.15.0 / Windows, selecting the Linux branch with a representative test-runner
Could the fixture also stub Scope: simulated Linux branch, not a full Linux suite run. |
nattallius
left a comment
There was a problem hiding this comment.
Overall looks good, with small comments
| const SEND_COMMAND_TIMEOUT = 60_000; // ms | ||
|
|
||
| function getCommandResponseTimeout(command: DaemonMessage): number { | ||
| if (command.method !== 'invoke_tool') { |
There was a problem hiding this comment.
No test covers this branch (commands other than invoke_tool). Could you add a test that sendCommand({method: 'status'}, '') still times out at exactly 60 s?
There was a problem hiding this comment.
Added a status-command case that remains pending at 59,999 ms and times out at 60,000 ms, preserving the default deadline for non-tool commands.
| return SEND_COMMAND_TIMEOUT; | ||
| } | ||
| // Leave time for the daemon to return the tool result without overflowing timers. | ||
| return Math.min(toolTimeout + SEND_COMMAND_TIMEOUT, 2 ** 31 - 1); |
There was a problem hiding this comment.
Two small things here:
-
Could you give both numbers a name, e.g.
MAX_TIMER_DELAY_MS = 2 ** 31 - 1andRESPONSE_GRACE_MS = 60_000(the extra time added to the tool timeout)? A one-line comment on why the grace period exists would help: the tool call can also spend time connecting to the browser (up toTOOL_CALL_TIMEOUT_MS) and building the response, which the tool timeout does not cover. -
Behavior change for short timeouts: with
--timeout 5000the CLI now waits 65 s instead of 60 s (before this PR stayed 60 s). I think this is fine and avoids the jump at 60 s, but please mention it in the description and add a test for a short tool timeout.
There was a problem hiding this comment.
Named the timer cap MAX_TIMER_DELAY_MS and the extra allowance RESPONSE_GRACE_MS, with a comment explaining browser connection and response construction. Added the 5,000 ms tool-timeout case with a 65,000 ms response deadline, and documented that short-timeout behavior in the PR description.
| await assertion; | ||
| }); | ||
|
|
||
| for (const timeout of [undefined, 0, -1, NaN, Infinity, '120000']) { |
There was a problem hiding this comment.
Nit: '120000' (a string) cannot come from the CLI, because yargs parses options with type: number as numbers. Could you remove this case? NaN (--timeout foo) and Infinity (--timeout Infinity) are real inputs, so those are good to keep.
There was a problem hiding this comment.
Removed the string timeout case, keeping NaN and Infinity as possible numeric CLI inputs.
|
Updated the deadline fixture to return a NUL-separated daemon command line for |
The CLI can stop waiting after 60 seconds even when a tool has a longer explicit timeout, losing the daemon's eventual result. Derive the default response deadline for
invoke_toolfrom a finite positive tool timeout plus the existing 60-second response allowance.Missing, nonnumeric, nonfinite, and nonpositive tool timeouts keep the existing default. Explicit socket deadlines remain authoritative, and derived deadlines are capped at Node's maximum timer delay to avoid overflowing into an immediate timeout.
This also applies to short positive timeouts:
--timeout 5000waits up to 65 seconds for the daemon response, instead of the previous 60 seconds. Commands other thaninvoke_toolretain the 60-second default.Follows the timeout approach discussed in #3110.
Fixes #2983.
Initial validation at
0c65963: the daemon client tests pass (27/27). The full suite has 1,815 passes, 3 skips, and one large full-page screenshot failure (Page is too large), also reproduced on unmodifiedmainat6b056c8. Format checks pass.