From 1a86ee2ad054a2c32bb46f8e13a08f0db6a11d67 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Fri, 5 Jun 2026 19:51:30 -0700 Subject: [PATCH] [eric] browser: redundant-read flag survives intervening reads, catches re-list clusters --- backend/apps/agents/browser/browser_agent.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/apps/agents/browser/browser_agent.py b/backend/apps/agents/browser/browser_agent.py index 4e3b6216..29d75b5a 100644 --- a/backend/apps/agents/browser/browser_agent.py +++ b/backend/apps/agents/browser/browser_agent.py @@ -1313,9 +1313,10 @@ async def run_browser_agent( ) if _auto_state: result["text"] = f"{result.get('text') or ''}{_auto_state}" - # mutating actions hand back fresh state; reads don't. drives the - # redundant-read nudge below. - fresh_state_pending = bool(_auto_state) + # a mutation attached fresh state; it stays "available" through + # intervening reads (Wait/Extract don't invalidate it), so a + # later solo re-list is still caught as redundant. + fresh_state_pending = True # Deferred replay re-check: the orchestrator often opens a fresh # card on the wrong host, so the dispatch-time replay missed. Once @@ -1435,6 +1436,7 @@ async def run_browser_agent( if (tu.name in ("BrowserListInteractives", "BrowserGetText") and _had_fresh_state and "error" not in result): redundant_read_nudges += 1 + fresh_state_pending = False # nudge once per attached-state cluster logger.info( f"[browser-batching {session_id}] redundant-read nudge #{redundant_read_nudges} " f"({tu.name}) at turn {turn}"