fix(cli): run a command that takes no session while a leased connection is active
Summary
With a leased connection saved as the machine's active connection, agent-device auth login, auth status and auth logout failed with REMOTE_SESSION_REQUIRED. The command could not satisfy the demand: auth does not accept --session, and it does not read AGENT_DEVICE_SESSION.
Cause: every command read the active connection's defaults, except a hand-kept list. auth was not on it, so the #3931 refusal fired for a command that runs on no connection.
Fix: a command that cannot take a session reads no connection. The rule replaces four entries of the list (daemon, plugins, device, proxy), which it covers, and also covers auth and web. Commands that take a session are unchanged: an unnamed command on a leased connection is still refused.
Before / after
With a leased connection active:
$ agent-device auth status
# before
Error (INVALID_ARGS): A leased remote connection needs its session named: pass --session <name> or set AGENT_DEVICE_SESSION.
# after
Not authenticated.
$ agent-device snapshot # unchanged
Error (INVALID_ARGS): A leased remote connection needs its session named: ...
Validation
pnpm check:affected --run --head 314ce9f5c0: passed,exactCommit=true.- New test in
cli-leased-session.test.ts:auth statusruns beside an active leased connection, with and withoutAGENT_DEVICE_SESSION, whilesnapshotis still refused. It fails without the fix. - Independent review: no findings.
src/cli.tsstays at the 1,000-line cap.- No device run: CLI option resolution only, no device-facing change.
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.