Skip to content

fix(cli): squad doctor validates state files against resolved team root in remote mode - #2057

Merged
tamirdresher merged 6 commits into
github:devfrom
ashtewari:ashtewari/2056-doctor-remote-state-dir
Oct 2, 2026
Merged

tamirdresher merged 6 commits into
github:devfrom
ashtewari:ashtewari/2056-doctor-remote-state-dir

Conversation

@ashtewari

Copy link
Copy Markdown
Contributor

Closes #2056

Problem

squad doctor correctly resolves the remote \ eamRoot\ for linked (dual-root) projects ([PASS] team root resolves), but then ran the \ eam.md/
outing.md/\�gents//\casting/registry.json/\decisions.md\ checks against the local .squad/\ directory instead of the resolved team root's .squad/. For a linked project whose local .squad/\ only contains \config.json, this produced false 'file not found' failures even though \squad status\ and \squad cast\ resolve and read the shared team correctly.

Fix


unDoctor()\ now resolves the state directory via \�ffectiveSquadDir()\ (\packages/squad-cli/src/cli/core/effective-squad-dir.ts) instead of calling
esolveStateDir(squadDir)\ directly on the local squad dir. \�ffectiveSquadDir()\ already implements the dual-root resolution used by \�uild, \copilot, \�xport, \loop, \plugin, and \watch\ — it follows \config.json's \ eamRoot\ via
esolveSquadPaths()\ in remote mode, and falls back to the local .squad/\ (with externalized-state support) otherwise. This makes \doctor\ consistent with how the rest of the CLI already resolves state in remote mode.

Testing

  • Added a regression test in \ est/cli/doctor.test.ts\ that reproduces the reported layout (central team root + linked project with only \config.json) and asserts all state-file checks now pass.

  • pm run build,
    pm run lint, and
    px vitest run test/cli/doctor.test.ts test/effective-squad-dir.test.ts\ pass (two unrelated tests in the full suite occasionally hit the 5s default timeout spawning \git/\copilot\ child processes on this machine — confirmed pre-existing/flaky and unaffected by this change; the remote-mode tests pass consistently in isolation).
  • Added a changeset (.changeset/2056-doctor-remote-state-dir.md) for @bradygaster/squad-cli.

…emote mode

squad doctor detected the remote teamRoot correctly but then ran the
team.md/routing.md/agents/casting/decisions checks against the local
.squad/ stub instead of the resolved team root's .squad/, producing
false 'file not found' failures for linked projects even though squad
status and squad cast resolved the team fine.

runDoctor() now uses effectiveSquadDir() (the same dual-root resolver
already used by build/copilot/export/loop/plugin/watch) to compute the
state dir, so it follows the remote teamRoot the same way the rest of
the CLI does. Fixes github#2056.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🛫 PR Readiness Check

ℹ️ This comment updates on each push. Last checked: commit af9ca86

PR Scope: 📦🔧 Mixed (product + infrastructure)

⚠️ 3 item(s) to address before review

Status Check Details
❌ Single commit 6 commits — consider squashing before review
✅ Not in draft Ready for review
✅ Branch up to date Up to date with dev
❌ Copilot review No Copilot review yet — it may still be processing
✅ Changeset present Changeset file found
✅ Scope clean No .squad/ or docs/proposals/ files
✅ No merge conflicts No merge conflicts
✅ Copilot threads resolved No Copilot review threads
❌ CI passing 5 check(s) still running

Files Changed (3 files, +44 −3)

File +/−
.changeset/2056-doctor-remote-state-dir.md +5 −0
packages/squad-cli/src/cli/commands/doctor.ts +6 −3
test/cli/doctor.test.ts +33 −0

Total: +44 −3


This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Impact Analysis — PR #2057

Risk tier: 🟡 MEDIUM

📊 Summary

Metric Count
Files changed 3
Files added 1
Files modified 2
Files deleted 0
Modules touched 3

🎯 Risk Factors

  • 3 files changed (≤5 → LOW)
  • 3 modules touched (2-4 → MEDIUM)

📦 Modules Affected

root (1 file)
  • .changeset/2056-doctor-remote-state-dir.md
squad-cli (1 file)
  • packages/squad-cli/src/cli/commands/doctor.ts
tests (1 file)
  • test/cli/doctor.test.ts

This report is generated automatically for every PR. See #733 for details.

@ashtewari
ashtewari marked this pull request as ready for review September 19, 2026 11:36
Copilot AI lite review requested due to automatic review settings September 19, 2026 11:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused resolver change and regression test address the reported remote-mode failure.

Review effort: Lite
Findings: None

What changed in this PR

Updates squad doctor to validate remote-mode state files from the resolved team root.

Changes:

  • Uses effectiveSquadDir() for state resolution.
  • Adds a remote-mode regression test.
  • Adds the CLI changeset.
File Description
doctor.ts Resolves state files against the effective team root.
doctor.test.ts Covers linked-project validation.
.changeset/​2056-doctor-remote-state-dir.md Documents the CLI patch.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…r-remote-state-dir

# Conflicts:
#	packages/squad-cli/src/cli/commands/doctor.ts
tamirdresher and others added 4 commits October 2, 2026 18:58
…b#2119

github#2119 introduced a richer, shared resolveSquadPaths-based resolution
utility in effective-squad-dir.ts. github#2057's remote-mode doctor fix
already targeted the resulting effectiveSquadDir() combined helper
(local + stateDir), so the only real conflict was the import line
switching from the module's standalone resolveStateDir export to
effectiveSquadDir; the call site and both PRs' new tests merge
cleanly side by side with no semantic overlap.
@tamirdresher
tamirdresher merged commit 67d9ed0 into github:dev Oct 2, 2026
17 checks passed
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.

squad doctor reports false failures for a linked (remote team root) project

4 participants