Skip to content

fix(tools): skip camofox auto-cleanup when managed persistence is enabled#6233

Merged
teknium1 merged 1 commit into
mainfrom
fix/camofox-managed-persistence-cleanup-v2
Apr 9, 2026
Merged

fix(tools): skip camofox auto-cleanup when managed persistence is enabled#6233
teknium1 merged 1 commit into
mainfrom
fix/camofox-managed-persistence-cleanup-v2

Conversation

@teknium1

@teknium1 teknium1 commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Salvaged from #6182 by @el-analista — thank you for catching this bug!

When managed_persistence is enabled, cleanup_browser() was calling camofox_close() after every agent task, which fires DELETE /sessions/{userId} and destroys the server-side browser context. This killed login sessions across cron runs.

Changes

tools/browser_camofox.py

  • Add camofox_soft_cleanup(task_id) — a public wrapper that drops only the in-memory session entry when managed persistence is on (returns True). When persistence is off, returns False so the caller falls back to the full camofox_close(). No private function leakage across modules.
  • Surface a logger.warning() when _managed_persistence_enabled() fails to load config (was a silent except Exception: return False).

tools/browser_tool.py

  • cleanup_browser() now calls camofox_soft_cleanup() first; only falls through to camofox_close() when it returns False.

Tests (5 new)

  • TestCamofoxSoftCleanup: returns True + drops session when enabled, returns False when disabled, never hits server DELETE
  • TestBrowserCleanup: cleanup_browser routes to soft_cleanup when camofox + managed persistence, routes to camofox_close when persistence is off

Co-authored-by: Eduardo Perea Fernandez el-analista@users.noreply.github.com

Closes #6182

…bled

When managed_persistence is enabled, cleanup_browser() was calling
camofox_close() which destroys the server-side browser context via
DELETE /sessions/{userId}, killing login sessions across cron runs.

Add camofox_soft_cleanup() — a public wrapper that drops only the
in-memory session entry when managed persistence is on, returning True.
When persistence is off it returns False so the caller falls back to
the full camofox_close().  The inactivity reaper still handles idle
resource cleanup.

Also surface a logger.warning() when _managed_persistence_enabled()
fails to load config, replacing a silent except-and-return-False.

Salvaged from #6182 by el-analista (Eduardo Perea Fernandez).
Added public API wrapper to avoid cross-module private imports,
and test coverage for both persistence paths.

Co-authored-by: Eduardo Perea Fernandez <el-analista@users.noreply.github.com>
@teknium1 teknium1 merged commit 3baafea into main Apr 9, 2026
3 of 4 checks passed
@teknium1 teknium1 deleted the fix/camofox-managed-persistence-cleanup-v2 branch April 9, 2026 01:07
Tommyeds pushed a commit to Tommyeds/hermes-agent that referenced this pull request Apr 12, 2026
…bled (NousResearch#6233)

When managed_persistence is enabled, cleanup_browser() was calling
camofox_close() which destroys the server-side browser context via
DELETE /sessions/{userId}, killing login sessions across cron runs.

Add camofox_soft_cleanup() — a public wrapper that drops only the
in-memory session entry when managed persistence is on, returning True.
When persistence is off it returns False so the caller falls back to
the full camofox_close().  The inactivity reaper still handles idle
resource cleanup.

Also surface a logger.warning() when _managed_persistence_enabled()
fails to load config, replacing a silent except-and-return-False.

Salvaged from NousResearch#6182 by el-analista (Eduardo Perea Fernandez).
Added public API wrapper to avoid cross-module private imports,
and test coverage for both persistence paths.

Co-authored-by: Eduardo Perea Fernandez <el-analista@users.noreply.github.com>
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…bled (NousResearch#6233)

When managed_persistence is enabled, cleanup_browser() was calling
camofox_close() which destroys the server-side browser context via
DELETE /sessions/{userId}, killing login sessions across cron runs.

Add camofox_soft_cleanup() — a public wrapper that drops only the
in-memory session entry when managed persistence is on, returning True.
When persistence is off it returns False so the caller falls back to
the full camofox_close().  The inactivity reaper still handles idle
resource cleanup.

Also surface a logger.warning() when _managed_persistence_enabled()
fails to load config, replacing a silent except-and-return-False.

Salvaged from NousResearch#6182 by el-analista (Eduardo Perea Fernandez).
Added public API wrapper to avoid cross-module private imports,
and test coverage for both persistence paths.

Co-authored-by: Eduardo Perea Fernandez <el-analista@users.noreply.github.com>
waym0reom3ga pushed a commit to waym0reom3ga/autolycus-agent that referenced this pull request May 8, 2026
…bled (NousResearch#6233)

When managed_persistence is enabled, cleanup_browser() was calling
camofox_close() which destroys the server-side browser context via
DELETE /sessions/{userId}, killing login sessions across cron runs.

Add camofox_soft_cleanup() — a public wrapper that drops only the
in-memory session entry when managed persistence is on, returning True.
When persistence is off it returns False so the caller falls back to
the full camofox_close().  The inactivity reaper still handles idle
resource cleanup.

Also surface a logger.warning() when _managed_persistence_enabled()
fails to load config, replacing a silent except-and-return-False.

Salvaged from NousResearch#6182 by el-analista (Eduardo Perea Fernandez).
Added public API wrapper to avoid cross-module private imports,
and test coverage for both persistence paths.

Co-authored-by: Eduardo Perea Fernandez <el-analista@users.noreply.github.com>
waym0reom3ga pushed a commit to waym0reom3ga/autolycus-agent that referenced this pull request May 8, 2026
…bled (NousResearch#6233)

When managed_persistence is enabled, cleanup_browser() was calling
camofox_close() which destroys the server-side browser context via
DELETE /sessions/{userId}, killing login sessions across cron runs.

Add camofox_soft_cleanup() — a public wrapper that drops only the
in-memory session entry when managed persistence is on, returning True.
When persistence is off it returns False so the caller falls back to
the full camofox_close().  The inactivity reaper still handles idle
resource cleanup.

Also surface a logger.warning() when _managed_persistence_enabled()
fails to load config, replacing a silent except-and-return-False.

Salvaged from NousResearch#6182 by el-analista (Eduardo Perea Fernandez).
Added public API wrapper to avoid cross-module private imports,
and test coverage for both persistence paths.

Co-authored-by: Eduardo Perea Fernandez <el-analista@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant