fix+feat(camoufox): ref_id regression fix and scroll parity#4
Merged
Conversation
Two changes bundled into 0.26.0-celeria-camoufox.2 because they both live in the sidecar and both matter for the end-to-end agent loop: 1. FIX: NameError on every page.snapshot call My 0b8c105 "scoped snapshot + ref renumbering" fix renamed the loop- local ref_id -> dom_ref but missed the ref_cache.put(ref_id, ...) call at the end of the same loop. Every snapshot raised `internal-error: name 'ref_id' is not defined` in the .1 release, which took out the core snapshot->click->fill flow. Fix keeps the two-ref distinction explicit: query the DOM by the pre-filter data-__ab-ref value (dom_ref), cache under the renumbered agent-facing ref (entry["ref"]). A regression test (test_interactive_only_snapshot_then_click_by_ref) exercises the full interactive_only snapshot -> click-by-ref flow and would have caught the original NameError. 2. FEAT: page.scroll + page.scrollIntoView parity with the Chrome path Previously returned `not-yet-implemented: action 'Runtime.evaluate' is not yet supported on engine=camoufox` because the sidecar had no scroll dispatch. The Rust side already normalises direction/amount -> dx/dy and passes {x, y, selector?} through; the sidecar now: - scrolls window when no selector is given - scrolls the element's own scroll container when selector is an @en ref or CSS selector - centres the element via scrollIntoView({block:'center', inline:'center'}) for page.scrollIntoView, mirroring the Chrome JS exactly - classifies Playwright errors into selector-not-found, ambiguous-selector, element-detached, ref-stale, timeout, action-failed (same taxonomy the click/fill paths use) Rust-side Camoufox arms added to handle_scroll and handle_scrollintoview in actions.rs. The two handlers now dispatch on mgr.backend.is_camoufox() and forward to mgr.camoufox_client().call("page.scroll"|"page.scrollIntoView"), so the sidecar protocol stays high-level rather than carrying CDP method strings. Still deferred to v2: screenshot --annotate. Ref-annotated screenshots need CDP DOM-box extraction; porting it cleanly means either computing bounding boxes via Playwright and compositing server-side or injecting an overlay via page.evaluate. Out of scope for this patch; the existing "not-yet-supported" error message already flags it as a v2 item. Files: - packages/camoufox-sidecar/camoufox_sidecar/snapshot.py - ref_id fix - packages/camoufox-sidecar/camoufox_sidecar/session.py - scroll + scroll_into_view methods - packages/camoufox-sidecar/camoufox_sidecar/__main__.py - register page.scroll and page.scrollIntoView handlers - packages/camoufox-sidecar/tests/test_commands.py - regression test for the ref_id bug + 6 tests covering the scroll surface - cli/src/native/actions.rs - Camoufox early-returns in handle_scroll and handle_scrollintoview - package.json + sync-version - bump to 0.26.0-celeria-camoufox.2 - CHANGELOG.md - new release block with Bug Fixes + New Features; previous .1 block demoted to <!-- old-release:* --> markers
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.
Two changes bundled into 0.26.0-celeria-camoufox.2 because they both live in the sidecar and both matter for the end-to-end agent loop:
FIX: NameError on every page.snapshot call My 0b8c105 "scoped snapshot + ref renumbering" fix renamed the loop- local ref_id -> dom_ref but missed the ref_cache.put(ref_id, ...) call at the end of the same loop. Every snapshot raised
internal-error: name 'ref_id' is not definedin the .1 release, which took out the core snapshot->click->fill flow. Fix keeps the two-ref distinction explicit: query the DOM by the pre-filter data-__ab-ref value (dom_ref), cache under the renumbered agent-facing ref (entry["ref"]). A regression test (test_interactive_only_snapshot_then_click_by_ref) exercises the full interactive_only snapshot -> click-by-ref flow and would have caught the original NameError.FEAT: page.scroll + page.scrollIntoView parity with the Chrome path Previously returned
not-yet-implemented: action 'Runtime.evaluate' is not yet supported on engine=camoufoxbecause the sidecar had no scroll dispatch. The Rust side already normalises direction/amount -> dx/dy and passes {x, y, selector?} through; the sidecar now:Rust-side Camoufox arms added to handle_scroll and
handle_scrollintoview in actions.rs. The two handlers now dispatch
on mgr.backend.is_camoufox() and forward to
mgr.camoufox_client().call("page.scroll"|"page.scrollIntoView"), so
the sidecar protocol stays high-level rather than carrying CDP
method strings.
Still deferred to v2: screenshot --annotate. Ref-annotated screenshots need CDP DOM-box extraction; porting it cleanly means either computing bounding boxes via Playwright and compositing server-side or injecting an overlay via page.evaluate. Out of scope for this patch; the existing "not-yet-supported" error message already flags it as a v2 item.
Files: