Skip to content

feat(browser): add browser login handoff tool for CAPTCHA/2FA sign-in - #137

Merged
convyusboy merged 6 commits into
boonfrom
feat/browser-login-handoff
Aug 20, 2026
Merged

convyusboy merged 6 commits into
boonfrom
feat/browser-login-handoff

Conversation

@convyusboy

@convyusboy convyusboy commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Today an agent dead-ends whenever a target site needs login, CAPTCHA, or 2FA:
the browser-automation skill explicitly tells the model to stop and report the
manual step. The customer has no way to hand a session over, so the whole task
halts.

Why This Change Was Made

Adds a bundled browser-handoff extension exposing a browser_handoff agent
tool (request_login / status / attach). The agent mints a hosted
sign-in link via boon-core, shares it with the customer, and the customer
signs in themselves (CAPTCHA/2FA happen on that hosted page, never in front of
the agent). Once done, the resulting session is registered as a reusable
browser profile so later runs need no human until the site's session
expires.

Key boundary: the tool never touches credentials — the human is always the one
who signs in. The Anchor vendor API key never leaves boon-core; the agent host
only ever gets a proxied session reference (never a raw cdp_url, which would
embed that key). The agent host does send BOON_API_KEY as a Bearer credential
to boon-core's browser_handoff endpoints, but that is the same generic,
already-provisioned boon-core credential every agent host already carries for
other outbound calls (matching the anychat-boon-web transport precedent) —
not a new secret, and not the Anchor key.

Because browser.profiles.* is core-owned/.strict() and a plugin cannot
import another extension's src/**, this also adds a small
browser-profile-config plugin-sdk facade (mirrors the existing
browser-maintenance bundled-facade pattern) so browser-handoff can
register/remove a remote-CDP browser profile without reaching into the
browser extension's internals.

Non-goal for this PR: the boon-core side (the broker service, BrowserProfile
model, and the actual /api/v1/agent/browser_handoff/* endpoints this client
calls) lives in a separate repo and is out of scope here.

User Impact

Agents can now hand off login-walled sites (e.g. construction bidding/plan-room
platforms) to the customer instead of silently stopping. Nothing changes for
sites that don't hit this path.

Evidence

  • node scripts/run-vitest.mjs extensions/browser-handoff — 14 tests covering
    the boon-core client (request/status wire format, error envelopes, retry
    behavior) and the full tool orchestration (request_login → status → attach,
    including the no-prior-handoff and already-attached error paths).
  • node scripts/run-vitest.mjs extensions/browser/index.test.ts — existing
    browser extension suite still green (14 tests) after adding
    browser-profile-mutations.ts.
  • node scripts/run-vitest.mjs src/plugin-sdk/facade-runtime.test.ts src/plugin-sdk/facade-loader.test.ts — facade loader/runtime contracts unaffected (22 tests).
  • node scripts/run-vitest.mjs src/plugins/bundled-plugin-metadata.test.ts — bundled plugin manifest/discovery still green (35 tests), confirming the new plugin's manifest is valid and needs no hardcoded id-list update.
  • node scripts/check-plugin-sdk-subpath-exports.mjs and node scripts/sync-plugin-sdk-exports.mjs --check — new browser-profile-config SDK subpath is correctly wired end-to-end.
  • Not run: tsgo typecheck and the full pnpm check:changed gate — this worktree has no installed node_modules and Crabbox isn't configured in this environment (no Azure CLI/credentials). Flagging as an open gap for CI/reviewer follow-up rather than claiming it passed.

Summary by cubic

Adds the bundled browser-handoff extension exposing a browser_handoff tool to hand login/CAPTCHA/2FA to the customer and reuse the session as a browser profile. Previously the agent dead‑ended on login walls; now it can mint a sign‑in link (request_login), check progress (status), and attach a remote CDP session (attach). Credentials never pass through the agent; sites without login behave unchanged.

  • Adds the browser-handoff plugin with a flat tool schema and in‑tool argument parsing for consistent error text.
  • Introduces a boon‑core client using BOON_API_KEY Bearer auth, SSRF‑guarded fetch, a stable Idempotency‑Key, and retries for network/5xx; propagates AbortError without retry; status rejects “ready” without profile_name.
  • Adds plugin-sdk/browser-profile-config and a browser public surface to register/unregister remote‑CDP profiles; registerRemoteCdpBrowserProfile validates cdpUrl, replaces existing profiles atomically to support re‑attach, preserves the existing profile and defaultProfile on failure, and preserves the profile’s color on replace unless explicitly overridden.
  • Updates the browser-automation skill to use browser_handoff instead of dead‑ending.
  • Documents plugin-sdk/browser-profile-config and updates the lockfile for the new workspace and runtime dependency.

Rollout

Written for commit 3a4c69a. Summary will update on new commits.

Review in cubic

@github-actions

github-actions Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • extensions/browser-handoff/package.json
  • pnpm-lock.yaml

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions

github-actions Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of @openclaw/openclaw-secops.

  • Current SHA: 3a4c69ac0e82ff6fe503d3a23515fed4a47dcdec
  • Trusted actor: @convyusboy
  • Trusted role: pull request author; repository admin

Security review is still recommended before merge when the dependency graph change is intentional.

@claude

claude Bot commented Aug 20, 2026

Copy link
Copy Markdown

Claude Code is working…

I'll analyze this and get back to you.

View job run

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 18 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

Re-trigger cubic

Comment thread extensions/browser-handoff/src/tool.ts Resolved
Comment thread src/plugin-sdk/entrypoints.ts Resolved
Comment thread extensions/browser-handoff/index.ts Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 9 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Adds a bundled browser-handoff extension exposing a browser_handoff tool
with request_login/status/attach actions, so an agent can hand a
login/CAPTCHA/2FA wall off to the customer via a hosted browser session
instead of dead-ending, then reuse the resulting session as a browser
profile. The customer always enters their own credentials; the tool never
touches them.

Also adds a browser-profile-config plugin-sdk facade (mirroring the
existing browser-maintenance bundled-facade pattern) so a sibling plugin
can register a remote-CDP browser profile without reaching into the
browser extension's internals, and routes the browser-automation skill's
login/CAPTCHA/2FA dead-end to the new tool.
… drift

- Regenerate pnpm-lock.yaml for the new extensions/browser-handoff workspace
  entry (was the root cause of every CI job failing on frozen-lockfile).
- registerRemoteCdpBrowserProfile: validate cdpUrl with parseBrowserHttpUrl
  before persisting, and delete-then-create so re-attaching an expired
  session on the same site replaces the profile instead of hitting the
  create-only conflict error.
- pollBrowserHandoffStatus: reject a ready status that omits profile_name
  instead of reporting success on a handoff that can never be attached.
- requestBrowserLoginHandoff: send a stable Idempotency-Key across retries
  so a 5xx retry cannot mint two handoffs; treat thrown network errors
  (not just 5xx responses) as retryable.
- Move browser_handoff argument parsing into tool.ts so invalid
  action/site produce the same "browser-handoff error:" text result as
  every other failure path, instead of a raw thrown tool-call error.
- Document the new plugin-sdk/browser-profile-config subpath in
  docs/plugins/sdk-subpaths.md.
…y, deps)

- tool.ts: BrowserHandoffToolTextResult was missing the required `details`
  field on AgentToolResult<T>, which tsgo caught as a real type error.
- boon-core-client.ts: replace raw fetch() with fetchWithSsrFGuard (required
  for outbound channel/plugin runtime calls per
  scripts/check-no-raw-channel-fetch.mjs), scoped to the request's own
  hostname via ssrfPolicyFromHttpBaseUrlAllowedHostname.
- package.json: declare typebox as a runtime dependency (schema.ts imports
  it), which extension-runtime-dependencies.contract.test.ts caught as an
  undeclared runtime import; regenerate pnpm-lock.yaml accordingly.
- Fix 3 oxlint errors (eslint(curly), 2x
  typescript(no-unnecessary-type-assertion)) surfaced once CI's lockfile
  drift was no longer masking every other check.
An unrelated PR (boon HEAD) landed after this branch forked and already
bumped these same budgets for its own change. Rebasing picked up that
baseline; bump it further by exactly this branch's own footprint (1 new
public entrypoint, 3 exports, 2 callable) from adding
plugin-sdk/browser-profile-config.
@convyusboy
convyusboy force-pushed the feat/browser-login-handoff branch from e6693a5 to 5a4b7d7 Compare August 20, 2026 09:09
- createBrowserProfileConfig: add replaceExisting to overwrite a profile in
  the same mutateConfigFile transaction instead of the caller deleting it
  first. A failed replacement (invalid endpoint, exhausted ports) now
  leaves the existing working profile untouched rather than deleting it
  and returning an error with nothing left; browser.defaultProfile is
  never touched by this path either way.
- registerRemoteCdpBrowserProfile: use replaceExisting instead of
  delete-then-create.
- boon-core-client.ts: propagate AbortError/an already-aborted signal
  as-is instead of wrapping it as a retryable error, so a caller-initiated
  cancellation doesn't burn two extra retry attempts.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

createBrowserProfileConfig's replaceExisting path still counted the
about-to-be-replaced entry's color as "used" when allocating a fresh one,
so the same named profile picked a new accent color on every reattach.
Reuse the existing profile's color when replacing, unless the caller
passes an explicit color.
@convyusboy
convyusboy merged commit 57b05f6 into boon Aug 20, 2026
146 of 147 checks passed
@convyusboy
convyusboy deleted the feat/browser-login-handoff branch August 20, 2026 11:25
convyusboy added a commit that referenced this pull request Aug 21, 2026
Cut a fork release containing the inbound-attachment-failure-visibility
fix from #139, the Slack reply-session-init-conflict retry from #132, and
the browser login handoff tool from #137.

Bump the gateway and published fork plugins in lockstep.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant