feat: page_text + auth_handoff tools and Chrome profile persistence#4
Merged
Conversation
…sistence Improvements driven by a real-world test case (scraping a JS-heavy SPA behind a login wall): - page_text: Playwright-based "navigate and extract text" tool that handles SPAs Scrapling can't reach - auth_handoff: returns the noVNC URL and (optionally) polls for an auth-complete signal so an agent can hand off login to a human - --persist-profile flag on `reach create` mounts a host directory as Chrome user data, so sessions survive sandbox restarts - E2E tests for the new tools (ignored by default) - Updated MCP tool docs and scraping guide Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
todie
force-pushed
the
feat/page-text-auth-handoff
branch
from
April 7, 2026 10:17
5ab4991 to
4cb9a38
Compare
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
Improvements driven by a real-world test case: scraping a JS-heavy SPA (Threads.com) gated behind a login wall. The existing toolset made this awkward —
scrape(Scrapling) struggles with JS-heavy SPAs,browserequires manual screenshot/click chains, and there was no way to hand off auth to a human or persist Chrome sessions across sandbox restarts.page_text— Playwright-based "navigate and extract rendered text" tool. Handles JS-heavy SPAs that Scrapling can't reach. Supportswait_forselector,selectorfilter, custom timeout, anduse_profilefor persistent sessions.auth_handoff— opens a URL in headed Chrome and returns the noVNC URL so a human can log in. Optionally polls (via a singlelaunch_persistent_contextPlaywright process) for await_for_selectororwait_for_url_containssignal indicating auth is complete.--persist-profile <name>flag onreach createmounts a host directory as Chrome user data. Profiles live under$XDG_DATA_HOME/reach/profiles/<name>(or config override), exposed in the container at/home/sandbox/.config/google-chrome-profiles/<name>. Sessions survive sandbox restarts.CLAUDE.md,docs/mcp-tools.md,docs/scraping.md(with a Threads-style auth handoff example).Design notes
launch_persistent_contextand polls inside the same Python process. Sidesteps Playwright's flakey CDP-attach story. Trade-off: the docker exec call blocks for up totimeout_seconds, which is fine for human-in-the-loop use.pub const &strand passed viapython3 -c, with the JSON payload threaded through env vars (REACH_PAGE_TEXT_PAYLOAD/REACH_AUTH_HANDOFF_PAYLOAD) to dodge shell quoting hell. Both helpers always exit 0 with a single JSON object on stdout — uniform parsing path on the Rust side./home/sandbox/.config/google-chrome-profiles/<name>); host root resolves viaSandboxDefaults::resolved_profile_dir()honoring$XDG_DATA_HOMEand config overrides. Profile name propagated as areach.profileDocker label.auth_handoffreads the actual mapped noVNC port viadocker.find(target), falling back to 6080. URL format centralized innovnc_url().Test plan
cargo fmt --all -- --checkcleancargo clippy --workspace --all-targets -- -D warningszero warningscargo test --workspace— 78 unit tests passingcargo build --workspace --releasesucceedst37_page_text_basic,t38_page_text_selector,t39_auth_handoff_returns_vnc_url) —#[ignore]d like the existing e2e suite, run withcargo test --workspace -- --ignored🤖 Generated with Claude Code