fix: /browser connect CDP override now takes priority over Camofox (#10523)

When a user runs /browser connect to attach browser tools to their real
Chrome instance via CDP, the BROWSER_CDP_URL env var is set. However,
every browser tool function checks _is_camofox_mode() first, which
short-circuits to the Camofox backend before _get_session_info() ever
checks for the CDP override.

Fix: is_camofox_mode() now returns False when BROWSER_CDP_URL is set,
so the explicit CDP connection takes priority. This is the correct
behavior — /browser connect is an intentional user override.

Reported by SkyLinx on Discord.
This commit is contained in:
Teknium
2026-04-15 14:11:18 -07:00
committed by GitHub
parent 824c33729d
commit 305a702e09
2 changed files with 21 additions and 1 deletions

View File

@@ -54,7 +54,15 @@ def get_camofox_url() -> str:
def is_camofox_mode() -> bool:
"""True when Camofox backend is configured."""
"""True when Camofox backend is configured and no CDP override is active.
When the user has explicitly connected to a live Chrome instance via
``/browser connect`` (which sets ``BROWSER_CDP_URL``), the CDP connection
takes priority over Camofox so the browser tools operate on the real
browser instead of being silently routed to the Camofox backend.
"""
if os.getenv("BROWSER_CDP_URL", "").strip():
return False
return bool(get_camofox_url())