From 47dfe760bed2952f9a0c34517e6358f0bbba1f87 Mon Sep 17 00:00:00 2001 From: leeguooooo Date: Sat, 9 May 2026 04:10:46 +0900 Subject: [PATCH] fix(cli): better message when only --headed is ignored in attach mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In CDP-attach mode (the default since 0.24.0-fork.1), --headed has no effect — the user's existing Chrome is already visible, and the generic "use 'agent-browser close' first to restart" advice doesn't help (the new daemon attaches right back). Explicitly say --headed is moot and point to --launch as the actual escape hatch. Other ignored flags (--profile, --proxy, etc.) keep the existing "close + reopen" message because for those it IS the right advice. --- cli/src/main.rs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index e474eb9..cd41560 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -822,11 +822,24 @@ fn main() { .collect(); if !ignored_flags.is_empty() && !flags.json { - eprintln!( - "{} {} ignored: daemon already running. Use 'agent-browser close' first to restart with new options.", - color::warning_indicator(), - ignored_flags.join(", ") - ); + // Special case: --headed is irrelevant in CDP-attach mode + // (your existing Chrome is always already visible). The + // "agent-browser close + reopen" advice doesn't help because + // the new daemon will attach right back to the same Chrome. + // Don't suggest a useless workaround. + if ignored_flags == ["--headed"] { + eprintln!( + "{} --headed has no effect when attached to your running Chrome (it's already visible). \ + Pass --launch to spawn a separate browser if you need to control headedness.", + color::warning_indicator(), + ); + } else { + eprintln!( + "{} {} ignored: daemon already running. Use 'agent-browser close' first to restart with new options.", + color::warning_indicator(), + ignored_flags.join(", ") + ); + } } }