Skip to content

fix: stop LLM retry loop when browser control service is unavailable#17673

Merged
sebslight merged 3 commits intoopenclaw:mainfrom
tag-assistant:fix/browser-tool-retry-loop
Feb 16, 2026
Merged

fix: stop LLM retry loop when browser control service is unavailable#17673
sebslight merged 3 commits intoopenclaw:mainfrom
tag-assistant:fix/browser-tool-retry-loop

Conversation

@tag-assistant
Copy link
Contributor

@tag-assistant tag-assistant commented Feb 16, 2026

Summary

  • Problem: When the browser control service is unreachable (e.g. after a gateway restart), the error message tells the LLM to "try again." The model obeys, calls the browser tool again, it fails again, and this loops until the agent timeout (5-10 min) kills it. Users see no response.
  • Why it matters: A single browser service interruption silently poisons the session — every subsequent message triggers the same infinite tool-call loop, burning through the full agent timeout with no reply.
  • What changed: Replaced the "try again" language in browser fetch errors with an explicit instruction telling the model NOT to retry and to use alternative approaches instead.

Change Type

  • Bug fix

Scope

  • Tools

Root Cause

src/browser/client-fetch.ts enhanceBrowserFetchError() generated error messages containing "try again" — language that LLMs interpret as an instruction to retry the tool call. Combined with pi-agent-core's agent loop having no tool-call iteration cap (while (true)), this creates an unbounded retry loop.

Fix

The error message now includes:

Do NOT retry the browser tool — it will keep failing. Use an alternative approach or inform the user that the browser is currently unavailable.

Operator-facing hints (restart gateway, check sandbox) are preserved for diagnostics.

User-visible / Behavior Changes

  • When the browser service is down, the agent will inform the user instead of silently timing out
  • Existing sessions with poisoned browser errors in context will recover on the next turn (new error text breaks the retry pattern)

Security Impact

  • No new permissions, secrets, network calls, or execution surface changes

Evidence

Diagnosed from production logs: three consecutive 300s timeouts on the same session, all caused by browser tool then "Can't reach... try again" then model retries then timeout.

Compatibility

  • Backward compatible
  • No config changes needed

Greptile Summary

Modified error messages in enhanceBrowserFetchError() to prevent LLM retry loops when the browser control service is unreachable. The fix replaces "try again" language with explicit instructions telling the model NOT to retry the browser tool and to use alternative approaches instead. This prevents unbounded tool-call loops that previously caused 5-10 minute agent timeouts with no user response.

Confidence Score: 5/5

  • Safe to merge - fixes critical user-facing issue with no regression risk
  • The change is narrowly scoped to error message text only, with no logic changes. It directly addresses a production issue where LLMs interpret "try again" as an instruction to retry, causing timeout loops. The new message explicitly instructs the model NOT to retry while preserving operator-facing diagnostic hints. Backward compatible and immediately improves poisoned sessions.
  • No files require special attention

Last reviewed commit: 7f47d98

@sebslight sebslight self-assigned this Feb 16, 2026
@sebslight sebslight force-pushed the fix/browser-tool-retry-loop branch from 7f47d98 to 2ba8e56 Compare February 16, 2026 02:49
@sebslight sebslight force-pushed the fix/browser-tool-retry-loop branch from 2ba8e56 to 90f47fe Compare February 16, 2026 02:53
@sebslight sebslight merged commit 6802b15 into openclaw:main Feb 16, 2026
3 checks passed
@sebslight
Copy link
Member

Merged via squash.

Thanks @tag-assistant!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments