Repository navigation
fix(browser): keep local action timeouts specific instead of service outage - #38852
SergioChan wants to merge 2 commits into
Conversation
Greptile SummaryThis PR correctly fixes the mis-classification of local browser action timeouts as a transport/service-outage error by splitting the Key finding:
Confidence Score: 3/5
Last reviewed commit: f01ae55 |
| `Browser action timed out after ${timeoutMs}ms while the local browser control service remained reachable. Try a fresh snapshot and retry with a stable ref, or increase timeoutMs if the action is expected to take longer. ${modelHint}`, | ||
| ); | ||
| } |
There was a problem hiding this comment.
Contradictory retry instructions in local timeout message
The local timeout error message appends a modelHint designed for service-outage scenarios, creating factually contradictory guidance:
- Message says: "service remained reachable" + "Try...retry with a stable ref"
- But also says: "Do NOT retry the browser tool" + "browser is currently unavailable"
Since this error indicates a recoverable action timeout (not a service outage), the modelHint should clarify that retry is acceptable when parameters change:
| `Browser action timed out after ${timeoutMs}ms while the local browser control service remained reachable. Try a fresh snapshot and retry with a stable ref, or increase timeoutMs if the action is expected to take longer. ${modelHint}`, | |
| ); | |
| } | |
| return new Error( | |
| `Browser action timed out after ${timeoutMs}ms while the local browser control service remained reachable. ` + | |
| `Try a fresh snapshot and retry with a stable ref, or increase timeoutMs if the action is expected to take longer. ` + | |
| `Do NOT retry the browser tool with the same parameters — it will keep failing. If the action cannot be completed, use an alternative approach or inform the user.`, | |
| ); |
This clarifies that retry is blocked only when parameters are unchanged, while allowing agents to retry with actionable changes.
Rule Used: CLAUDE.md (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/browser/client-fetch.ts
Line: 130-132
Comment:
**Contradictory retry instructions in local timeout message**
The local timeout error message appends a `modelHint` designed for service-outage scenarios, creating factually contradictory guidance:
- Message says: "service remained reachable" + "Try...retry with a stable ref"
- But also says: "Do NOT retry the browser tool" + "browser is currently unavailable"
Since this error indicates a recoverable action timeout (not a service outage), the `modelHint` should clarify that retry is acceptable when parameters change:
```suggestion
return new Error(
`Browser action timed out after ${timeoutMs}ms while the local browser control service remained reachable. ` +
`Try a fresh snapshot and retry with a stable ref, or increase timeoutMs if the action is expected to take longer. ` +
`Do NOT retry the browser tool with the same parameters — it will keep failing. If the action cannot be completed, use an alternative approach or inform the user.`,
);
```
This clarifies that retry is blocked only when parameters are unchanged, while allowing agents to retry with actionable changes.
**Rule Used:** CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
How can I resolve this? If you propose a fix, please make it concise.|
Thanks for the catch — addressed in 2a953fd.\n\n### What changed\n- Split model guidance so local action timeouts no longer reuse the service-outage wording.\n- Local timeout guidance now explicitly allows retry only after changing parameters (fresh refs / higher timeout), and avoids saying the browser service is unavailable.\n- Service-outage guidance remains strict about not repeating unchanged retries.\n\n### Validation\n- |
|
Correction: validation run was pnpm vitest run src/browser/client-fetch.timeout-errors.test.ts (executed locally and passing before push). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a953fdd6e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (looksLikeTimeoutError(err)) { | ||
| if (isLocal) { | ||
| return new Error( | ||
| `Browser action timed out after ${timeoutMs}ms while the local browser control service remained reachable. Try a fresh snapshot and retry with a stable ref, or increase timeoutMs if the action is expected to take longer. ${localTimeoutModelHint}`, |
There was a problem hiding this comment.
Preserve abort errors instead of rewording as local timeouts
For relative browser routes, this branch rewrites every looksLikeTimeoutError into "Browser action timed out ... service remained reachable", but looksLikeTimeoutError also matches aborts (abort/aborted). In fetchBrowserJson, an upstream AbortSignal cancellation flows into this path, so caller-initiated cancels get misreported as timeouts with retry advice, which is misleading and can trigger unnecessary retries when the operation was intentionally canceled rather than timing out.
Useful? React with 👍 / 👎.
Summary
Describe the problem and fix in 2–5 bullets:
fetchBrowserJsonmapped local browser action timeouts to a transport outage error (Can't reach the OpenClaw browser control service), which is misleading when the local dispatcher is alive but the action itself timed out.client-fetch.timeout-errors.test.tsto lock in this behavior.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Local browser action timeouts (relative routes) now report as action timeouts while the control service is reachable, instead of incorrectly reporting browser-control-service outage.
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
fetchBrowserJsonon a local/relative browser route where dispatcher throws a timeout-like error.pnpm exec vitest run src/browser/client-fetch.timeout-errors.test.ts.Expected
Actual
Browser action timed out after ... while the local browser control service remained reachable.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
f01ae55.src/browser/client-fetch.ts, removesrc/browser/client-fetch.timeout-errors.test.ts.Risks and Mitigations