Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tools/browser_camofox.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ def _managed_persistence_enabled() -> bool:
"""
try:
camofox_cfg = load_config().get("browser", {}).get("camofox", {})
except Exception:
except Exception as exc:
logger.warning("managed_persistence check failed, defaulting to disabled: %s", exc)
return False
return bool(camofox_cfg.get("managed_persistence"))

Expand Down
13 changes: 10 additions & 3 deletions tools/browser_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1935,11 +1935,18 @@ def cleanup_browser(task_id: Optional[str] = None) -> None:
if task_id is None:
task_id = "default"

# Also clean up Camofox session if running in Camofox mode
# Also clean up Camofox session if running in Camofox mode.
# Skip cleanup when managed persistence is enabled — the whole point
# is that the browser profile (and its session cookies) survives across
# agent tasks. The inactivity reaper still frees idle resources.
if _is_camofox_mode():
try:
from tools.browser_camofox import camofox_close
camofox_close(task_id)
from tools.browser_camofox import camofox_close, _managed_persistence_enabled, _drop_session
if _managed_persistence_enabled():
_drop_session(task_id)
logger.debug("Camofox cleanup skipped for task %s (managed persistence)", task_id)
else:
camofox_close(task_id)
except Exception as e:
logger.debug("Camofox cleanup for task %s: %s", task_id, e)

Expand Down
Loading