From fcd2e8b87b588e570e3fb3510441e1b595bc008b Mon Sep 17 00:00:00 2001 From: Daniel Dolezal Date: Sat, 2 May 2026 20:03:50 +0200 Subject: [PATCH] fix: skip route-resolution for server-side auth commands; pass key_spec not loaded key MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit browser-cli.auth.keys and browser-cli.auth.trust are handled by serve.py directly and never need a _route profile, so they no longer trigger _auto_route_remote (which would open a second connection just to discover available browser profiles). Also fixes _auto_route_remote receiving an already-loaded AgentKey object instead of the key spec string — the nested send_command call couldn't re-load it for signing, causing auth failures. Co-Authored-By: Claude Sonnet 4.6 --- browser_cli/client.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/browser_cli/client.py b/browser_cli/client.py index 38f4b2d..906da10 100644 --- a/browser_cli/client.py +++ b/browser_cli/client.py @@ -315,8 +315,9 @@ def send_command(command: str, args: dict | None = None, profile: str | None = N if private_key is None and resolved_token: msg["token"] = resolved_token route_profile = requested_profile - if not route_profile and command != "browser-cli.targets": - route_profile = _auto_route_remote(remote_endpoint, resolved_token, key=private_key) + _no_route_commands = {"browser-cli.targets", "browser-cli.auth.keys", "browser-cli.auth.trust"} + if not route_profile and command not in _no_route_commands: + route_profile = _auto_route_remote(remote_endpoint, resolved_token, key=key_spec) if route_profile: msg["_route"] = route_profile else: