fix(cli): stop auth from leasing or demanding a session through a remote config
Merged
SA
6d ago+74+74+01234567890123456789-32-32-01234567890123456789
Summary
A command that takes no session should run on no remote connection. #4839 applied that rule when the CLI reads the active connection. The leased-session guard, the remote-auth check, and the materialization check in src/cli.ts kept their own rules, and auth broke in two ways:
auth status --remote-config <profile>started a local daemon, leased a device, and saved the profile as the active connection.- With a profile that names a lease provider, it failed with
REMOTE_SESSION_REQUIRED, butauthrejects--session.
All four checks now read one predicate, isFlagSupportedForCommand('session', command). The help and three user docs now limit the session requirement to commands that take a session.
Closes #4850. Scope expansion: the two auth fixes.
Before / after
Built CLI, fresh state directory:
auth status --remote-config generic.json: base writesdaemon.jsonandremote-connections/default.json. Head writes nothing.auth status --remote-config leased.json: base fails withREMOTE_SESSION_REQUIRED. Head succeeds.snapshot --remote-config leased.json:REMOTE_SESSION_REQUIREDat both.auth login --remote-config, from code reading only: head no longer sends the profile's tenant, run, and daemon URL as device-auth hints.
Validation
pnpm check:affected --run --head 18ec3c8b6: all checks passed except 2 untouched unit tests that hit the 5 s timeout and pass alone. Base6b4e4c1a1times out the same way on this loaded host. CI owns full unit.check:command-docs,check:doc-prose, andcheck:doc-linkspass.- Every new assertion fails when its fix is reverted.
- An independent Opus review approved.
Reviewed with sol-loop: 2 rounds with gpt-6.2-sol. Sol verdict: approved
Created with Claude Opus 5.5 in Claude Code.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.