feat(profile): --profile auto + stop steering users into temp-profile launches

Addresses the footgun raised in issue #1 follow-up: plain `--launch` silently
uses a temporary EMPTY profile (no cookies/login), and the connect-failure
error even recommended it — trapping agents into thinking they reused the
logged-in browser when they didn't.

- `--profile auto`: resolves to the Chrome profile last used (from Local State
  `profile.last_used`), falling back to "Default", then the first profile. So
  `--launch --profile auto open <url>` reuses real login state without naming
  the profile. (--profile <name>/Default already worked.)
- connect-failure error now recommends `--launch --profile auto` and states
  plainly that bare `--launch` is a temporary EMPTY profile — no cookies/login.
- bare `--launch` (no --profile, not CI) now prints a warning to that effect.
- README: fix Setup (relaunch with --remote-debugging-port, not chrome://inspect)
  and split Standalone mode into throwaway vs. keep-your-login (`--profile auto`).

Tests: resolve_chrome_profile("auto") prefers last_used, falls back to Default.
This commit is contained in:
leeguooooo
2026-06-01 18:30:11 +09:00
parent 54b61f4375
commit ed61be3359
4 changed files with 99 additions and 6 deletions
+10 -4
View File
@@ -1609,9 +1609,12 @@ async fn auto_launch(state: &mut DaemonState) -> Result<(), String> {
"Could not connect to your Chrome browser.\n\n\
If Chrome showed an \"Allow remote debugging?\" dialog, click \
Allow and re-run that consent is what lets agent-browser attach.\n\n\
Otherwise, to let agent-browser work with your existing Chrome (recommended):\n\
Otherwise, to let agent-browser reuse your logged-in Chrome (recommended):\n\
{}\n\n\
Or start a standalone browser with: agent-browser --launch open <url>\n\n\
Or launch a separate browser that KEEPS your login state:\n \
agent-browser --launch --profile auto open <url>\n\
(plain `--launch` alone uses a temporary EMPTY profile no cookies, \
no logged-in sessions.)\n\n\
Note: remote debugging is a startup flag, not a Chrome setting \
chrome://inspect/#remote-debugging only enables target discovery and \
does NOT expose the CDP HTTP API on /json/version. \
@@ -2172,9 +2175,12 @@ async fn handle_launch(cmd: &Value, state: &mut DaemonState) -> Result<Value, St
"Could not connect to your Chrome browser.\n\n\
If Chrome showed an \"Allow remote debugging?\" dialog, click \
Allow and re-run that consent is what lets agent-browser attach.\n\n\
Otherwise, to let agent-browser work with your existing Chrome (recommended):\n\
Otherwise, to let agent-browser reuse your logged-in Chrome (recommended):\n\
{}\n\n\
Or start a standalone browser with: agent-browser --launch open <url>\n\n\
Or launch a separate browser that KEEPS your login state:\n \
agent-browser --launch --profile auto open <url>\n\
(plain `--launch` alone uses a temporary EMPTY profile no cookies, \
no logged-in sessions.)\n\n\
Note: remote debugging is a startup flag, not a Chrome setting \
chrome://inspect/#remote-debugging only enables target discovery and \
does NOT expose the CDP HTTP API on /json/version. \