feat: add persistent browser sessions and VNC URL discovery for Camofox#4400
Open
el-analista wants to merge 5 commits intoNousResearch:mainfrom
Open
feat: add persistent browser sessions and VNC URL discovery for Camofox#4400el-analista wants to merge 5 commits intoNousResearch:mainfrom
el-analista wants to merge 5 commits intoNousResearch:mainfrom
Conversation
- Move _vnc_url_checked flag after JSON parse to prevent permanent failure when health returns non-JSON body - Validate vncPort is integer in range 1-65535 - Reset VNC globals in test fixture to prevent order-dependent flakiness - Add tests for config-yaml toggle, explicit-false env values, VNC URL discovery (port present/absent/invalid), and navigate VNC hint Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enables running arbitrary JS in the page context (e.g. window.scrollBy for horizontal scrolling, DOM queries for elements outside the accessibility tree). Wraps the existing /evaluate endpoint in camofox.
call_llm returns a response object with .choices[0].message.content, not a plain string. Passing the raw object to json.dumps caused serialization failures, making browser_vision always error out.
The browser_tool default (8K chars) was too aggressive and cut off sidebar elements like "Add to Watchlist" buttons that appear late in the accessibility tree. Camofox snapshots rarely exceed 80K chars (server-side limit), so a 400K char (~100K token) threshold avoids losing interactive elements while still capping truly huge pages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two features to the Camofox browser backend:
Persistent Browser Sessions
browser.camofox.managed_persistenceconfig option (alsoCAMOFOX_MANAGED_PERSISTENCEenv var)tools/browser_camofox_state.pymodule for profile-scoped identity generationVNC URL Discovery
/healthendpoint now returnsvncPortwhen running in headed modeCAMOFOX_URL(works with remote hosts, not just localhost)camofox_navigateresponses so the agent can share it with usersTest Coverage
Tests: 377 → 377 (+0 new files, +9 new tests in existing files)
Key test coverage:
Pre-Landing Review
Pre-Landing Review: 3 issues (0 critical, 3 auto-fixed)
[tools/browser_camofox.py:71]_vnc_url_checked set before resp.json() could fail → moved after parse[tools/browser_camofox.py:73]vncPort accepted without type validation → added int + range check[tests/test_browser_camofox_persistence.py:33]Test fixture missing VNC global cleanup → addedTest plan
🤖 Generated with Claude Code