Skip to content

fix(cli): say doctor auth --fix has nothing to repair in an open space's root - #7113

Merged
davidfarah-dev merged 1 commit into
Cotal-AI:mainfrom
dodoshell:fix-7092-doctor-fix-open-space
Nov 17, 2026
Merged

davidfarah-dev merged 1 commit into
Cotal-AI:mainfrom
dodoshell:fix-7092-doctor-fix-open-space

Conversation

@dodoshell

Copy link
Copy Markdown
Contributor

Fixes #7092. In the root of a space registered as open, cotal doctor auth is a no-op, but cotal doctor auth --fix refused with AUTH_REQUIRED, and its next step named the command that had just failed.

Problem

In the root of an open space (cotal up --open), cotal doctor auth --space sp2 reports "No credentials to check" and exits 0. cotal doctor auth --space sp2 --fix in the same folder refuses:

Request refused
  no validated signing trust for the named local diagnostic scope is present; no open mode or broader authority was inferred
  Outcome: refused
  Code:    AUTH_REQUIRED
  Space:   sp2

Next
  run `cotal doctor auth --space sp2 --fix` in that space's root folder; `cotal space` lists each space's root

(exit 2). The user is already in that root, so following the step gives the same refusal again. The two runs differ only in the flag.

Root cause

In implementations/cli/src/commands/doctor.ts, the open-space check is skipped when --fix is passed:

const open = values.fix ? undefined : recordedOpenSpace(root, values.space);

With open undefined, --fix falls through to the values.fix || values.space refusal. The skip came in with the check itself in 2f76fd7 ("say doctor auth has nothing to check in an open space's root"). That commit, its changeset, its docs and #4538, which merged it, only describe the plain diagnosis and give no reason to keep --fix out.

Fix

Run the open-space check for --fix as well. On an open space, --fix now returns the same no-op report and exits 0, with repair.requested: true and repair.attempted: false in the JSON.

A no-op is the right result here. An open space issues no credentials, so --fix has nothing to re-sign or migrate, and on a static space --fix with nothing to repair is already reported as a no-op (noOp: values.fix === true && !repair.attempted && ...). The check itself is unchanged: recordedOpenSpace resolves read-only and returns a space only when its registration says mode: "open" and this folder is its registered root. Missing signing trust is still not read as an open space, and --fix in a folder with no space, or for a space whose trust this root does not hold, still refuses as before.

docs/cli-auth.mdx now says the open-space no-op holds with or without --fix. There is also a @cotal-ai/cli patch changeset.

Testing

  • Extended case 5 of implementations/cli/smoke/no-space-next.smoke.ts (broker-free). In the root of a space registered as open, it runs doctor auth --fix --json with and without --space. Each run must be a no-op that names the space, has the open-space scope, has repair requested and not attempted, and exits 0.
  • Red before the fix (pnpm smoke:no-space-next, exit 1): the first --fix run throws the issue's refusal, CommandFailure: no validated signing trust for the named local diagnostic scope is present; no open mode or broader authority was inferred (code: 'AUTH_REQUIRED', remedy run `cotal doctor auth --fix` in a space's root folder; `cotal space` lists each space's root).
  • Green after the fix: COTAL_SMOKE_SENTINEL cells=40 passed=40 failed=0 (30 before).
  • Real entry point: with a private COTAL_HOME, an open registration for sp2, and the CLI rebuilt, I ran tsx bin/cotal.ts doctor auth --space sp2 --fix in that root. Before the fix it printed the refusal above (exit 2). After the fix it printed "No credentials to check ... Mode: open, as registered" (exit 0). --json gives "outcome":"no-op" with "repair":{"requested":true,"attempted":false,...}.
  • pnpm --filter @cotal-ai/cli typecheck (source and smoke tree), pnpm check:docs-voice, pnpm check:docs-literals and pnpm changeset status --since=upstream/main pass.
  • Not run: the full pnpm smoke:ci gate (it needs nats-server).

…e's root

doctor auth already reported an open space's root as a no-op, but --fix
skipped that check and refused AUTH_REQUIRED with a next step that named
the command that had just failed. Run the check for --fix too: an open
space issues no credentials, so the repair is requested and not attempted,
and the result is a no-op (exit 0).

Fixes Cotal-AI#7092
@davidfarah-dev
davidfarah-dev merged commit 070a882 into Cotal-AI:main Nov 17, 2026
@davidfarah-dev

Copy link
Copy Markdown
Contributor

Thanks. I reproduced the refusal on 0.165.1 (doctor auth --fix in an open space's root exited 2 with AUTH_REQUIRED) and checked this change on current main: the same command is now a no-op with exit 0, and smoke:no-space-next passes. Merged.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doctor auth --fix is refused on an open space and its remedy loops on itself

2 participants