Skip to content

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

Merged
thymikee merged 1 commit into
callstack:mainfrom
samanyudas:refactor/cli-session-less-commands
Nov 21, 2026
Merged

thymikee merged 1 commit into
callstack:mainfrom
samanyudas:refactor/cli-session-less-commands

Conversation

@samanyudas

@samanyudas samanyudas commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

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.

View guided diff

A command that cannot take a session runs on no remote connection. The CLI
already derived that for reading the active connection (callstack#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 callstack#4850

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@samanyudas
samanyudas marked this pull request as draft November 21, 2026 08:54
@thymikee

Copy link
Copy Markdown
Member

Thanks for the fix. At 18ec3c8 the change looks ready, and the 2 checks are green with none failing. There are no conflicts.

Not blocking, and fine to take or leave: auth still lists remoteConfig in its supported flags in command-overrides.ts, but no auth path reads it now, so auth ... --remote-config <path> parses the profile and then does nothing. A follow-up issue could either drop the flag from auth (it then fails as unsupported) or pass the profile hints to loginWithDeviceAuth explicitly.

Not verified here: the tests were not run and the fix was not reverted, so the regression check is reasoned from the base code path. The built CLI before/after run from the PR body was not repeated. The commands without --session were not enumerated at runtime; the list was read from command-overrides.ts.

Nothing from review stands in the way of merge.

@samanyudas

Copy link
Copy Markdown
Contributor Author

Note

🤖 Drafted by Claude Opus 5.5. Reviewed by @samanyudas and posted on their behalf.

Filed #4887 for the auth --remote-config flag, with both options.

On the points you could not verify, this is what I observed locally at 18ec3c8:

  • src/__tests__/cli-leased-session.test.ts passes 10/10. Each new assertion fails when its fix is reverted. The web doctor case fails with REMOTE_SESSION_REQUIRED under the pre-fix(cli): run a command that takes no session while a leased connection is active #4839 rule. The remote-config case sees lease_allocate under the old materialization list, and REMOTE_SESSION_REQUIRED under the old guard.
  • The built CLI before/after runs in the PR body come from base 6b4e4c1a1 and this head.
  • I listed the commands without --session at runtime, by calling isFlagSupportedForCommand('session', …) over listCliCommandNames(): auth, daemon, device, mcp, plugins, proxy, web.

The CI workflows on this PR are still waiting for approval (action_required), so GitHub has not run lint, typecheck, or the unit suite here yet.

@samanyudas
samanyudas marked this pull request as ready for review November 21, 2026 10:12
@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 21, 2026
@thymikee
thymikee merged commit 55be96b into callstack:main Nov 21, 2026
18 of 26 checks passed
thymikee pushed a commit that referenced this pull request Nov 22, 2026
…pported commands (#4957)

auth stopped running on remote connections in #4879 and already stripped
every remote-config profile field in finalizeParsedArgs, making it the
only session-less command still listing remoteConfig. Drop remoteConfig
from auth.supportedFlags so every session-less command rejects it, and
guard resolveCliOptions so --remote-config files are not read before
unsupported-flag validation rejects the command.

Closes #4887
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI: derive the remaining session-less command lists and cover web beside a leased connection

2 participants