fix(errors): stop suggesting --timeout, which adapter commands do not accept - #2425
fix(errors): stop suggesting --timeout, which adapter commands do not accept#2425cat0825 wants to merge 2 commits into
Conversation
… accept
The default TimeoutError hint told users to retry with `--timeout <seconds>`,
but adapter commands never declare that flag. Only `browser wait`
(--timeout <ms>) and `antigravity serve` (--timeout <seconds>) do, so
following the advice produced `error: unknown option '--timeout'` and
turned a retryable TIMEOUT (exit 75) into a usage error (exit 1).
Point the default hint at OPENCLI_BROWSER_COMMAND_TIMEOUT, which is the
mechanism that actually applies to adapter commands. Call sites passing an
explicit hint are unaffected.
The existing assertion used toContain('timeout'), which matched the broken
text as well as the fixed one; tighten it and add a regression test that
fails on the old wording.
Fixes jackwener#2415
|
Rechecked against current No conflict: the two changes are in different regions (this PR is the
So this is still mergeable as-is; happy to rebase if you'd prefer a linear history. Same check on the other two branches (#2426, #2427): neither touches a file changed by the last six upstream commits. The workflow run is still sitting at |
|
Updated onto current Scope: stops the error path from suggesting @jackwener low-risk one whenever you have a moment. Two siblings alongside it: #2426 (update-check) and #2427 (doctor). |
Description
The default
TimeoutErrorhint tells users to retry with--timeout <seconds>, but adapter commands do not declare that flag — following the advice fails with a different error.Only two commands in the repo accept
--timeout, and neither is an adapter command:browser wait(--timeout <ms>,src/cli.ts:2412) andantigravity serve(--timeout <seconds>,src/cli.ts:3612). The default hint is reached from the genericrunWithTimeout()wrapper (src/runtime.ts:24-31) used by adapter execution, plus a handful of adapters that omit the third constructor argument.Before:
This matters most for agents driving OpenCLI programmatically: the natural recovery is to retry with the flag the error text named, which converts a retryable
TIMEOUT(exit 75) into an opaque usage error (exit 1).The fix points the default hint at
OPENCLI_BROWSER_COMMAND_TIMEOUT, which is the knob that actually applies to adapter commands. The 49 call sites that pass an explicithintare unaffected.Related issue: Fixes #2415
Type of Change
Checklist
Tests
The existing assertion was
expect(err.hint).toContain('timeout'), which matches the broken text as well as the fixed one — it could not catch this. Tightened it to assert the env var, and added two cases:--timeout(fails on the old wording — verified by reverting the source and re-running:AssertionError: expected 'Try again, or increase timeout with -…' not to contain '--timeout')Baseline on
mainbefore the change was 7286 passing; the +2 are the new cases.Note
While this is being touched, there is an adjacent inconsistency worth flagging separately:
browser waittakes--timeoutin milliseconds whileantigravity servetakes seconds, so a user who does find a working--timeoutmay still pass the wrong magnitude. I left that alone here to keep the change minimal — happy to open a follow-up if you'd like it unified.