Skip to content

fix(#1188): browser_navigate spiral cap regression — 15-deep spirals#1199

Merged
Lexus2016 merged 1 commit into
mainfrom
evolution/issue-1188-browser-nav-regression
Jul 21, 2026
Merged

fix(#1188): browser_navigate spiral cap regression — 15-deep spirals#1199
Lexus2016 merged 1 commit into
mainfrom
evolution/issue-1188-browser-nav-regression

Conversation

@Lexus2016

Copy link
Copy Markdown
Owner

Summary

Fixes #1188browser_navigate failures regress with 15-deep consecutive spirals across 30 sessions, despite the existing cap=3.

Root Cause

Two independent root causes prevented the cap from enforcing:

1. bot_detection_warning misclassified as success (agent/display.py)

browser_navigate returns {"success": true, "bot_detection_warning": "..."} when it successfully navigates to a bot-detection/Cloudflare/captcha page (the browser-level navigation succeeded, but the page is a blocked page). The failure classifier _detect_tool_failure saw success: true and returned failed=False — so the guardrail counter never incremented. The model retried 15× against a blocked page that will never load properly.

Fix: Added a bot_detection_warning check to both _detect_tool_failure (production path) and classify_tool_failure (fallback classifier) — when success=true AND bot_detection_warning is present, classify as [bot detection] failure.

2. Intermittent success resets cross-turn streak (agent/tool_guardrails.py)

A single successful navigation (e.g., to a different, fast-loading page between failing attempts) fully cleared _cross_turn_tool_failure_counts via pop(), resetting the streak to 0. The cap never accumulated because the pattern fail, succeed, fail, succeed, fail... kept the counter below the threshold.

Fix: Decay the cross-turn streak by 1 on success instead of clearing it. Multiple consecutive successes still drain to 0 (a genuinely recovered backend is not penalized), but a fail/succeed/fail pattern now accumulates toward the cap and eventually halts.

Verification

  • E2E reproduction confirmed both root causes (standalone scripts, not committed)
  • scripts/run_tests.sh tests/agent/test_tool_guardrails.py — 65/65 tests pass
  • scripts/run_tests.sh tests/agent/test_display.py tests/tools/test_browser_navigate_fallback.py tests/agent/test_tool_result_classification.py — 75/75 pass
  • 4 new tests + 2 updated tests covering both fixes

Files Changed

  • agent/display.py_detect_tool_failure: classify bot_detection_warning as failure
  • agent/tool_guardrails.pyclassify_tool_failure: mirror the bot_detection check; after_call: decay cross-turn streak by 1 on success instead of clearing
  • tests/agent/test_tool_guardrails.py — 4 new + 2 updated tests

Two root causes for the browser_navigate cap=3 not enforcing:

1. bot_detection_warning misclassified as success (agent/display.py)
   browser_navigate returns success=True with bot_detection_warning when
   it lands on a Cloudflare/captcha page. _detect_tool_failure saw success=True
   and returned failed=False, so the guardrail counter never incremented.
   The model retried 15× against a blocked page that never loads. Fix: classify
   bot_detection_warning results as failures in both _detect_tool_failure and
   classify_tool_failure (the fallback classifier).

2. Intermittent success resets cross-turn streak (agent/tool_guardrails.py)
   A single successful navigation (e.g., to a different, fast-loading page
   between failing attempts) fully cleared _cross_turn_tool_failure_counts via
   pop(), resetting the streak to 0. The cap never accumulated. Fix: decay the
   streak by 1 on success instead of clearing it. Multiple consecutive successes
   still drain to 0 (genuinely recovered backend is not penalized), but a
   fail/succeed/fail pattern now accumulates toward the cap.

Tests: 4 new tests + 2 updated tests in test_tool_guardrails.py, all 65 pass.
@Lexus2016 Lexus2016 added the bug Something isn't working label Jul 21, 2026
@Lexus2016
Lexus2016 merged commit 8d04bcf into main Jul 21, 2026
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FIX] browser_navigate failures regress — 15 failures / 30 sessions with 15-deep consecutive spirals

1 participant