diff --git a/backend/apps/agents/browser/browser_agent.py b/backend/apps/agents/browser/browser_agent.py index 6ea81fc8..25967497 100644 --- a/backend/apps/agents/browser/browser_agent.py +++ b/backend/apps/agents/browser/browser_agent.py @@ -2060,7 +2060,7 @@ async def run_browser_agent( f"[browser-agent {session_id}] browser card {browser_id} is unusable " f"({card_gone_streak} consecutive gone/hung results); aborting fast" ) - if os.environ.get("OSW_DEADCARD_EVICT") == "1": + if os.environ.get("OSW_DEADCARD_EVICT", "1") != "0": DEAD_CARDS.add(browser_id) logger.info(f"[browser-agent] {browser_id} marked dead; same-host reuse will skip it") break @@ -2408,7 +2408,7 @@ async def run_browser_agents( await execute_browser_tool("BrowserNavigate", {"url": url}, browser_id) except Exception: pass - elif os.environ.get("OSW_PRELUDE_TRIM") == "1": + elif os.environ.get("OSW_PRELUDE_TRIM", "1") != "0": # Poll until the mounting card serves real page text instead of a blind 2s; capped, so the worst case is the old wait plus one probe. p_mount_t0 = time.monotonic() while time.monotonic() - p_mount_t0 < 2.5: @@ -2429,7 +2429,7 @@ async def run_browser_agents( is_pre_selected = browser_id in pre_selected p_nav_url = url or ("" if reused else entry_url) # The fresh card already opened AT entry_url, so the pre-loop nav is a full second page load of the same page; trim mode drops it (perceive reads the mounting page, and the loop can still navigate itself if that read comes up empty). - if (os.environ.get("OSW_PRELUDE_TRIM") == "1" and not reused and not url + if (os.environ.get("OSW_PRELUDE_TRIM", "1") != "0" and not reused and not url and entry_url and p_nav_url == entry_url): p_nav_url = "" try: diff --git a/backend/apps/agents/browser/browser_fast_read.py b/backend/apps/agents/browser/browser_fast_read.py index bd13a0f9..627ca041 100644 --- a/backend/apps/agents/browser/browser_fast_read.py +++ b/backend/apps/agents/browser/browser_fast_read.py @@ -40,7 +40,7 @@ P_MAX_LINKS = 60 def hop_enabled() -> bool: - return os.environ.get("OSW_FASTREAD_HOP") == "1" + return os.environ.get("OSW_FASTREAD_HOP", "1") != "0" def extract_links(html: str, base_url: str) -> list[tuple[str, str]]: diff --git a/backend/apps/agents/browser/browser_prestage.py b/backend/apps/agents/browser/browser_prestage.py index 2b13bdba..67bc1246 100644 --- a/backend/apps/agents/browser/browser_prestage.py +++ b/backend/apps/agents/browser/browser_prestage.py @@ -51,7 +51,7 @@ ToolRunner = Callable[[str, dict, str, str], Awaitable[dict]] def prestage_enabled() -> bool: - return os.environ.get("OSW_PRESTAGE") == "1" + return os.environ.get("OSW_PRESTAGE", "1") != "0" def list_entry_for(list_text: str, index: int) -> str: diff --git a/backend/tests/conftest.py b/backend/tests/conftest.py index 1cfeb17b..4f5a1dcf 100644 --- a/backend/tests/conftest.py +++ b/backend/tests/conftest.py @@ -29,6 +29,11 @@ def _isolate_browser_state(monkeypatch): monkeypatch.setenv("OPENSWARM_BROWSER_SKILLS_DIR", skills_dir) monkeypatch.setenv("OPENSWARM_BROWSER_METRICS_DIR", metrics_dir) monkeypatch.setenv("OPENSWARM_BROWSER_PLAYBOOK_DIR", playbook_dir) + # The speed levers are default-ON in prod; pin them off for the suite so mocked loop tests keep exact aux-call/turn expectations (same pattern as OPENSWARM_PERSISTENT_CLIENT). The levers are exercised by their own live gates + targeted tests that set the flag explicitly. + monkeypatch.setenv("OSW_PRESTAGE", "0") + monkeypatch.setenv("OSW_FASTREAD_HOP", "0") + monkeypatch.setenv("OSW_PRELUDE_TRIM", "0") + monkeypatch.setenv("OSW_DEADCARD_EVICT", "0") def _reset(): for mod in ("browser_skills", "browser_playbook"):