mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-06 17:57:43 +02:00
[eric] browser: flip speed levers default-ON (hop/prestage/trim/evict, kill switch =0); conftest pins them off for the mocked suite
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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]]:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"):
|
||||
|
||||
Reference in New Issue
Block a user