fix(cli): stop auth from leasing or demanding a session through a remote config

Merged
SA
6d ago
+74-32

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, but auth rejects --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 writes daemon.json and remote-connections/default.json. Head writes nothing.
  • auth status --remote-config leased.json: base fails with REMOTE_SESSION_REQUIRED. Head succeeds.
  • snapshot --remote-config leased.json: REMOTE_SESSION_REQUIRED at 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. Base 6b4e4c1a1 times out the same way on this loaded host. CI owns full unit.
  • check:command-docs, check:doc-prose, and check:doc-links pass.
  • 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.


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