…#4879)
A command that cannot take a session runs on no remote connection. The CLI
already derived that for reading the active connection (#4839), but the
leased-session guard, the remote-auth check, and the materialization check
kept their own rules. Two bugs followed for `auth`:
- `auth status --remote-config <profile>` started a local daemon, leased a
device on it, and saved the profile as the active connection.
- With a profile that names a lease provider, `auth status --remote-config`
failed with REMOTE_SESSION_REQUIRED, and `auth` rejects `--session`.
All four checks now read one predicate. The explicit lists keep only the
commands that differ for another reason: `connection status` sends no
request, and the connection-lifecycle commands materialize the connection
themselves. The leased-sessions help and the remote-proxy, device-clouds,
and commands docs now limit the session requirement to commands that take a
session, and the leased-session test covers `web doctor`.
Closes #4850
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
With a leased connection saved as the machine's active connection,
agent-device auth login,auth statusandauth logoutfailed withREMOTE_SESSION_REQUIRED. The command could not satisfy the demand:authdoes not accept--session, and it does not readAGENT_DEVICE_SESSION.Cause: every command read the active connection's defaults, except a hand-kept list.
authwas 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 coversauthandweb. Commands that take a session are unchanged: an unnamed command on a leased connection is still refused.Before / after
With a leased connection active:
Validation
pnpm check:affected --run --head 314ce9f5c0: passed,exactCommit=true.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.src/cli.tsstays at the 1,000-line cap.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.