Skip to content

[codex] Enable local cookie sync for Browser Use cloud - #23

Merged
Cheggin merged 1 commit into
mainfrom
confusion-gecko
May 31, 2026
Merged

[codex] Enable local cookie sync for Browser Use cloud#23
Cheggin merged 1 commit into
mainfrom
confusion-gecko

Conversation

@Cheggin

@Cheggin Cheggin commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a browser profile sync runtime command that copies local Chromium cookies into Browser Use cloud through temporary browser sessions.
  • Add a sync-cookies CLI command and /sync-cookies TUI flow with API-key gating and local profile selection.
  • Default to all cookies and use distinct Browser Use cloud profile names so the source and target are clear.

Validation

  • scripts/verify-terminal-ui.sh
  • cargo test -p browser-use-tui sync_cookies -- --nocapture
  • cargo test -p browser-use-tui mouse_capture -- --nocapture
  • cargo test -p browser-use-tui logo_click -- --nocapture

Not Tested

  • Live Browser Use cloud cookie import with a real API key.

Summary by cubic

Sync local Chromium cookies to Browser Use cloud profiles via a new browser profile sync runtime command, a sync-cookies CLI, and a /sync-cookies TUI flow. The TUI gates on auth, lists local profiles, runs a temporary cloud browser session (CDP Storage.setCookies), and shows a clear “Complete” message with bold cookie counts. Lightweight text-only analytics log initial, follow-up, request-input, and blocked (no-auth) user messages across core/CLI/TUI.

  • New Features

    • Runtime: browser profile sync imports local cookies into Browser Use cloud using a temporary remote session, with API-key gating, include/exclude domain filters, profile selection when omitted, and JSON responses (ok/needs-auth/needs-user-action).
    • CLI: sync-cookies [LOCAL_PROFILE] [--all-cookies|--domain ...] [--exclude-domain ...] [--cloud-profile-id|--cloud-profile-name|--new-cloud-profile-name]; reads BROWSER_USE_API_KEY from settings or env when present; pretty-prints JSON.
    • TUI: /sync-cookies surface that checks for a cloud key, lists local profiles, syncs with status updates, and shows a bold cookie count on completion; accessible from the command palette.
    • Cloud profiles: resolve by id/name or create a new one with a distinct default like “Browser Use - ”.
    • Core: browser-use-core::run_standalone_browser_command and ..._with_browser_use_api_key to invoke runtime commands; analytics capture initial/follow-up/request-input and blocked messages.
  • Migration

    • Add a Browser Use cloud API key via /auth or set BROWSER_USE_API_KEY.
    • CLI example: browser-use-terminal sync-cookies 'google-chrome:Default' --all-cookies.
    • Optional: target an existing cloud profile with --cloud-profile-id/--cloud-profile-name, or filter with --domain / --exclude-domain.

Written for commit b35645e. Summary will update on new commits.

Review in cubic

@Cheggin
Cheggin force-pushed the confusion-gecko branch from 38dee77 to a487b78 Compare May 31, 2026 04:56
@Cheggin
Cheggin marked this pull request as ready for review May 31, 2026 05:00

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 8 files

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

Fix all with cubic | Re-trigger cubic

Comment thread crates/browser-use-tui/src/main.rs Outdated
Comment thread crates/browser-use-tui/src/render.rs Outdated
Users need a direct way to copy local Chromium cookie state into a Browser Use cloud profile, and agents need the same operation available through the browser runtime command surface when explicitly requested.

This adds a profile sync runtime command, a user-facing sync-cookies CLI command, and a /sync-cookies TUI flow that gates on a Browser Use API key, lists local profiles, and imports all cookies by default into a distinct cloud profile name.

Constraint: Browser Use cloud accepts browser state through a live remote browser CDP session, so the sync flow starts temporary local and cloud browser sessions rather than relying on a bulk upload endpoint.

Rejected: Expose a broad browser CLI command | it would widen the user-facing tool surface beyond the cookie-sync use case.

Confidence: high

Scope-risk: moderate

Directive: Keep this flow scoped to cookie syncing unless another explicit browser profile operation earns its own user-facing command.

Tested: scripts/verify-terminal-ui.sh

Tested: cargo test -p browser-use-browser profile_sync -- --nocapture

Tested: cargo test -p browser-use-tui sync_cookies -- --nocapture

Tested: cargo test -p browser-use-cli sync_cookies -- --nocapture

Tested: cargo test -p browser-use-core browser_tool_description -- --nocapture

Not-tested: Live Browser Use cloud cookie import with a real API key

Co-authored-by: OmX <omx@oh-my-codex.dev>
@Cheggin
Cheggin force-pushed the confusion-gecko branch from a487b78 to b35645e Compare May 31, 2026 05:17
@Cheggin

Cheggin commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

@cubic review

@cubic-dev-ai

cubic-dev-ai Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

@cubic review

@Cheggin I have started the AI code review. It will take a few minutes to complete.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 8 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="crates/browser-use-core/src/product_analytics.rs">

<violation number="1" location="crates/browser-use-core/src/product_analytics.rs:137">
P1: Avoid sending raw user message text to product analytics; this introduces a privacy/security data-exposure risk.</violation>
</file>

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

Fix all with cubic | Re-trigger cubic

"is_child_task": is_child_task,
"message_kind": message_kind,
"message_seq": message_seq,
"text": text,

@cubic-dev-ai cubic-dev-ai Bot May 31, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: Avoid sending raw user message text to product analytics; this introduces a privacy/security data-exposure risk.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/browser-use-core/src/product_analytics.rs, line 137:

<comment>Avoid sending raw user message text to product analytics; this introduces a privacy/security data-exposure risk.</comment>

<file context>
@@ -34,6 +43,106 @@ pub fn capture_blocking(store: &Store, event: &str, properties: Value) {
+        "is_child_task": is_child_task,
+        "message_kind": message_kind,
+        "message_seq": message_seq,
+        "text": text,
+        "text_chars": text.chars().count() as i64,
+    });
</file context>
Fix with Cubic

@Cheggin
Cheggin merged commit 0bb18dc into main May 31, 2026
6 checks passed
dhanushk-offl pushed a commit to dhanushk-offl/terminal that referenced this pull request Jun 3, 2026
[codex] Enable local cookie sync for Browser Use cloud
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