From 80ccdfc76ea83dbb5d750de7aa4e6100f9db4d60 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Thu, 16 Jul 2026 14:35:08 -0700 Subject: [PATCH] [eric] browser: skip plan-dispatch when the send composer is already staged (4.7s of aux poking for nothing) --- backend/apps/agents/browser/browser_agent.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/apps/agents/browser/browser_agent.py b/backend/apps/agents/browser/browser_agent.py index 5e72b27e..058bcbc9 100644 --- a/backend/apps/agents/browser/browser_agent.py +++ b/backend/apps/agents/browser/browser_agent.py @@ -1431,9 +1431,11 @@ async def run_browser_agent( "retried; report this outcome verbatim. " + p_dr) # Code-side plan dispatch (the turn-collapser that doesn't wait for the model to adopt a tool): one aux call compiles the task's mechanical prefix into verified steps, code executes them, and the big model starts with that work DONE. Fail-open: no plan/steps = today's loop untouched. + # A send task whose composer is ALREADY staged has no mechanical prefix left (the model's one fill turn + autosend own the rest), so skip the aux call instead of letting it poke the composer (measured 4.7s of nothing). from backend.apps.agents.browser import browser_plan_dispatch + p_composer_staged = bool(task_is_send and browser_send_script.composer_index_in_state(preloaded_perception or "")) if (browser_plan_dispatch.plan_dispatch_enabled() and not app_mode and not done_called - and preloaded_perception and not cancel_event.is_set()): + and preloaded_perception and not p_composer_staged and not cancel_event.is_set()): try: p_plan_note = await asyncio.wait_for(browser_plan_dispatch.run_plan_dispatch( task, preloaded_perception, browser_id, tab_id,