Chief: import browser cookies from Chrome on request

Merged
AU
3d ago
+93-13

Fixes https://github.com/manaflow-ai/cmux/issues/32960

What

A Chief can now import the user's sign-ins from another browser (Chrome, or any other browser cmux reads) when the user asks. The app's existing consent panel asks the user first.

The app action already existed (browser.importCookies, CLI cmux browser import-cookies, MCP app_browser_import_cookies). A Chief could not use it in practice:

  • Only the subagent prompt said how to import cookies. The Chief's own prompt did not, in either its MCP or CLI-launcher form.
  • The app did not receive a Chief's caller.home_chat. The consent panel would have named the Chief's temporary turn session id ("Agent chat “optchat-turn-…”") with no chat to reveal.

Changes

  • chief-kernel prompt (MCP and CLI-launcher forms): only when the user asks, run cmux browser import-cookies --from chrome[:PROFILE] --domain SITE --reason "why" from the shell with a 4-minute timeout, using the fewest sites. The CLI waits up to 210 s and the panel up to 180 s, so a shorter shell timeout would report a failure while the panel is still open. A denial imports nothing and the Chief says so. Goldens updated.
  • App: ActionInvocation.callerHomeChat is filled from the control request. CookieImportRequester names a Chief's run "Chief", and Show Agent Chat reveals the home workspace's docked chat (found the same way as ControlCallerLocation.homeChat). A CLI run that names only caller.home_chat must give a reason. TabModel.isHomeDockPage is new. CmuxNextApp lines: -1.
  • iOS parity row: the request can come from the phone's Chief chat, but Allow happens on the Mac, since the cookies live on that Mac.

Why the CLI rather than the MCP tool

The first push added app_browser_import_cookies to the Chief turn's cmux MCP allowlist. The review flagged that this reverses 1298092486 / 53f549ce41 ("Chief presets expose no Mac actions", pinned by agent_tools_tests::chief_turn_tools_contain_no_mac_app_actions). That push was reverted in 8af92c61c57f.

An owner's Chief turn already has a shell, so the CLI gives it the same capability without widening its tool grant. If the MCP form is wanted later, it needs that policy owner's sign-off through https://github.com/manaflow-ai/cmux/issues/13742.

Trust

The consent gate does not change. Every run that is not the user's own in-app run must give a reason, and nothing is read from the other browser until the user clicks Allow on the panel. macOS's Keychain prompt follows. In a turn started by another person in a shared chat, the host refuses the shell (and every tool outside approval::turn_allowed_tools), so that turn cannot import.

Tests

  • CmuxNextAppTests.CookieImportCommandTests: requesterOfAChiefTurnIsTheChiefInHome (new), and agentsMustGiveAReason now covers a home_chat-only CLI run. On the base this suite does not compile (callerHomeChat does not exist).
  • chief-kernel render_system goldens (all six local prompt forms carry the new line; cloud-plain is unchanged) and tools.
  • Chief first-turn cost guard (scripts/ci/chief-first-turn-cost.sh) at the head.

Observed / Not run

Observed at head 8af92c61c57fedfb197e470148ae0e74a6d075c0:

  • CmuxNextAppTests.CookieImportCommandTests: 11/11 passed (cmux-ci step 5d0e9e47361b194d1c687fd4, aws-m4pro-7). This also compiles the CmuxNext package.
  • chief-kernel render_system: 14/14; tools: 6/6 (rbx, lane nx-32960-kernel).
  • Chief first-turn cost guard: PASS, 21,157 of 50,000 tokens (cmux-ci step ef841ef0b3788cc5a14dfe80). The router's count_tokens returned 502, so these are the script's local estimates.
  • Dev build 32960-chief-cookie-import: cmux-ci job 19fcbbacfa2ca937388b5a7a, published.
  • Base check: the suite above cannot compile on the base (ActionInvocation.callerHomeChat does not exist there).
  • At the first head 5acc9adcccc0: optchat-chief cloud_app_tools 11/11, harness 28/28 and approval_gates 21/21. Those files are unchanged at the final head.

Not run:

  • A live Chief turn in the tagged app, end to end: the panel showing "Agent chat “Chief”", Allow, then cookies landing in a cmux browser tab. This needs a person at the Mac to answer the panel and the Keychain prompt.
  • acpmux tests: the acpmux files are unchanged at the final head.

Changelog

  • Added: Chiefs can import your browser sign-ins (for example from Chrome) when you ask. cmux asks you to Allow first.

🤖 Generated with Claude Code