Skip to content

feat(desktop): open recordings and runs in an opted-in Chrome profile - #2358

Open
abrichr wants to merge 9 commits into
mainfrom
claude/desktop-chrome-profile
Open

abrichr wants to merge 9 commits into
mainfrom
claude/desktop-chrome-profile

Conversation

@abrichr

@abrichr abrichr commented Nov 20, 2026

Copy link
Copy Markdown
Member

Desktop can open the installed Google Chrome on a separate, Desktop-managed profile after the person agrees to an engine-served notice (SHA-256 acknowledged, re-asked when it changes, revocable with delete). The person signs in once (SSO or two-factor as usual); Chrome keeps the sign-ins, and recordings and runs attach through the existing browser_cdp_endpoint contract.

Mechanism and why: see packages/desktop/docs/CHROME_PROFILE.md. Chrome ignores remote debugging on its default profile; copying a profile exports its cookie and password stores (and needs the macOS keychain); an extension plus native messaging adds a per-OS host and store or policy install for no extra reach.

Fail closed (codes in the doc): changed or missing consent, Chrome's own profile folders, a profile already open (SingletonLock / lockfile), a Chrome that hands off and exits, an elevated Windows Desktop (Chrome restarts itself de-elevated, so the handle is lost), or a /json/version that doesn't name the browser ID Desktop read from DevToolsActivePort on loopback.

Close only what Desktop opened: Browser.close to that process's verified endpoint, then the Popen handle; never by name. Engine exit closes owned windows.

Never: cookie or password reads, keychain calls or keychain flags (static test). Only official Google Chrome; Chrome for Testing and Chromium are refused. Commands are window-only (not on the tray or agent socket; tested). Does not touch authoring_runner.py (#2259 owns it; that path stays empty-cookie).

Tests: fakes-only unit tests (test_chrome_profile.py), vitest for the picker, and a real-Chrome test (test_chrome_profile_real.py, OPENADAPT_REAL_CHROME=1) in a new Real Chrome profile job on GitHub macOS and Windows runners, and on the Windows lab without admin rights.

@abrichr
abrichr marked this pull request as ready for review November 20, 2026 23:46
Desktop can open the installed Google Chrome on a separate, Desktop-managed
profile after the person agrees to an engine-served notice. They sign in once
(SSO or two-factor as usual) and Chrome keeps the sign-ins; recordings and
runs attach through the existing browser_cdp_endpoint contract.

Fail closed on a changed notice, a default Chrome folder, a profile already
open elsewhere, a Chrome that hands off and exits, or an endpoint that doesn't
name the process Desktop started. Close only that process (Browser.close,
then the handle). No cookie, password or keychain access.
Chrome restarts itself without admin rights when started elevated, so the
handle Desktop holds exits and the window can't be verified or closed by it.
Refuse before launch. Never probe a pid with os.kill on Windows. Adds the
Windows lab run and the CAPABILITIES row.
Spawn through child_process.popen (no new session, which would fork the
engine). Move the Chrome profile handlers into chrome_profile.py; dispatch.py
gains two lines, and its budget row rises by those two.
@abrichr
abrichr force-pushed the claude/desktop-chrome-profile branch from bf25be6 to b498f94 Compare November 21, 2026 00:18
On a cold macOS runner /json/version timed out right after Chrome wrote
DevToolsActivePort. Retry an unreachable server until the start timeout; an
endpoint that answers for another browser is still refused at once.
@abrichr

abrichr commented Nov 21, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: 2169f35

I will not merge.

Author is abrichr, not Grok. No prior Grok verdict at this head. I did not review authoring_runner.py.

The requested checks hold:

  • Fail-closed: a create or open is refused when the acknowledged SHA-256 is missing or no longer matches the notice the engine serves; _refuse_default_dir rejects Chrome's own profile folders; profile_in_use treats a live SingletonLock (including another host, or an unreadable link) and a held Windows lockfile as already open; a Chrome that exits before DevToolsActivePort appears is treated as a handoff (profile_in_use); an elevated Windows Desktop, and an elevation check that itself fails, refuse before spawn; /json/version must be loopback, the same port and /devtools/browser/… path as DevToolsActivePort, and Browser must start with Chrome/. A launch that can't be verified terminates the Popen handle and does not send Browser.close to that endpoint.

  • Close uses only the process Desktop stored in _owned: it re-verifies that the endpoint still names that browser, sends a masked Browser.close over that path with no Origin header, then waits on the handle and only then terminate/kills it. If the endpoint no longer matches, Browser.close is skipped and only the handle is terminated. close of a profile Desktop did not open is a no-op. Engine exit calls close_all_owned.

  • A source scan of the module (docstrings and comments stripped) has none of the cookie, password, keychain, Local State, storage_state, or copytree entry points. Launch flags do not include --password-store or --use-mock-keychain. The only profile files this module reads are DevToolsActivePort and the lock file.

  • _verify_when_ready retries only when the refusal is attach_unverified with an underlying exception (an unreachable /json/version). A foreign websocket path or a non-Chrome Browser field is refused on the first answer.

  • The chrome_profile commands are on the window dispatcher only. They are absent from socket_server._SOCKET_COMMANDS (tray, local agent, and setup agent).

  • CHROME_PROFILE.md correctly explains why this is a separate opted-in profile (Chrome ignores --remote-debugging-port on the everyday user-data directory; copying that profile would export cookie and password stores; a native-messaging extension is a larger always-installed surface).

Tests cover those refusals, the retry rule, close ownership, the window-only allowlist, and the elevated-Windows path. I will not merge. This head is MERGEABLE/BLOCKED; the author asked to wait for a Desktop version bump, and desktop release intent is still red.

@abrichr

abrichr commented Nov 22, 2026

Copy link
Copy Markdown
Member Author

Independent adversarial review: APPROVE

From: Grok
Reviewed-Head: d338a0e

Review only. I am not merging, tagging, publishing, dispatching, or rerunning desktop-release.yml. This is a delta stamp versus my APPROVE at 2169f352a51efaaafaab36ec70e1d34e3c99cd27.

The new work is a merge of current main plus prepare_release.py --bump minor (0.31.2 → 0.32.0). The unique Chrome-profile feature tree, including the dispatch.py handler hook, is unchanged. Version is consistent across the desktop metadata files and CHANGELOG.md starting ## v0.32.0 (2026-11-22).

Merging this PR auto-publishes openadapt-desktop 0.32.0 through desktop-release.yml after a successful Packages run on main. That is authorization, not a dry run.

Merge-order note (not a blocker of this PR's own tree): OpenAdapt#2305 also stamps desktop 0.32.0, with a different unique tree (shared theme roles). desktop-release.yml will never republish 0.32.0. Whichever of #2358 or #2305 merges first owns that version; the other must rebump (0.32.1 or later). OpenAdapt#2324 stamps 0.31.3 and should merge before either 0.32.0, or it will also have to drop/rebump.

I approve this head. I am not merging it.

# Conflicts:
#	packages/desktop/CHANGELOG.md
#	packages/desktop/openadapt_desktop/__init__.py
#	packages/desktop/package-lock.json
#	packages/desktop/package.json
#	packages/desktop/pyproject.toml
#	packages/desktop/src-tauri/Cargo.lock
#	packages/desktop/src-tauri/Cargo.toml
#	packages/desktop/src-tauri/tauri.conf.json
#	packages/desktop/uv.lock

This branch has not been deployed

No deployments
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