Skip to content

fix(doctor): use autoDetectSkillsDir so OpenClaw workspaces are reachable#684

Closed
brandonlipman wants to merge 1 commit into
garrytan:masterfrom
brandonlipman:fix/doctor-uses-autodetect
Closed

fix(doctor): use autoDetectSkillsDir so OpenClaw workspaces are reachable#684
brandonlipman wants to merge 1 commit into
garrytan:masterfrom
brandonlipman:fix/doctor-uses-autodetect

Conversation

@brandonlipman
Copy link
Copy Markdown
Contributor

@brandonlipman brandonlipman commented May 6, 2026

What

gbrain doctor is the only consumer of findRepoRoot() from core/repo-root.ts. Every other consumer (check-resolvable.ts:145, skillify.ts, etc.) uses autoDetectSkillsDir(), which has the full detection chain:

  1. \$OPENCLAW_WORKSPACE
  2. ~/.openclaw/workspace
  3. findRepoRoot() walk from cwd
  4. ./skills

findRepoRoot only does step 3. Result: when the user runs gbrain doctor from any directory outside the gbrain repo or the OpenClaw workspace tree (e.g., a project checkout), resolver_health reports Could not find skills directory even though the dispatcher exists at ~/.openclaw/workspace/skills/RESOLVER.md.

Repro

In any directory other than ~/gbrain or its descendants, on a system with ~/.openclaw/workspace/skills/RESOLVER.md present:

```
$ cd ~/Documents
$ gbrain doctor
[WARN] resolver_health: Could not find skills directory # before
```

But:

```
$ gbrain check-resolvable --verbose
Auto-detected skills directory from ~/.openclaw/workspace/skills: /Users/.../.openclaw/workspace/skills
```

Same machine, same setup, two different commands disagree on whether the skills dir exists. The disagreement is the bug.

Fix

Switch doctor to autoDetectSkillsDir. Brings it inline with the rest of the codebase. The detected dir is now also passed to checkSkillConformance (step 2 of the resolver_health block), which previously rebuilt the path from repoRoot — now uses the same detected path for consistency.

Test

All 15 existing tests in test/doctor.test.ts continue to pass.

```
$ bun test test/doctor.test.ts
15 pass, 0 fail, 39 expect() calls
```


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

…able

`gbrain doctor` was the only consumer of `findRepoRoot` from
`core/repo-root.ts`. Every other consumer (check-resolvable.ts:145,
skillify.ts, etc.) uses `autoDetectSkillsDir`, which has the full
detection chain:
  1. \$OPENCLAW_WORKSPACE
  2. ~/.openclaw/workspace
  3. findRepoRoot() walk from cwd
  4. ./skills

`findRepoRoot` only does step 3. Result: when the user runs `gbrain
doctor` from any directory outside the gbrain repo or the OpenClaw
workspace tree (e.g., a project's checkout), `resolver_health` reports
"Could not find skills directory" even though the dispatcher exists at
~/.openclaw/workspace/skills/RESOLVER.md.

Reproduces in any directory other than ~/gbrain or its descendants on
a system with ~/.openclaw/workspace/skills/RESOLVER.md present:

    \$ cd ~/Documents
    \$ gbrain doctor
    [WARN] resolver_health: Could not find skills directory   # before
    [WARN] resolver_health: 5 issue(s): 0 error(s), 5 warning(s)  # after

Switching doctor to `autoDetectSkillsDir` brings it inline with the rest
of the codebase. The detected dir is also passed to
`checkSkillConformance` (step 2 of the resolver_health block), which
previously rebuilt the path from `repoRoot` — now uses the same
detected path for consistency.

All 15 existing tests in test/doctor.test.ts continue to pass.
@garrytan
Copy link
Copy Markdown
Owner

Closing — your fix landed in master via the v0.30.3 fix-wave PR #776 (merged at ff53a4c9): "doctor uses autoDetectSkillsDir".

Thank you for the contribution — credit is preserved in the v0.30.3 CHANGELOG entry. 🙏

@garrytan garrytan closed this May 10, 2026
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.

2 participants