Resolve Claude workspace roots so Context Health can scan them - #273
Open
mostafaseyedan wants to merge 1 commit into
Open
mostafaseyedan wants to merge 1 commit into
mostafaseyedan wants to merge 1 commit into
Conversation
Every Claude workspace is silently dropped from the Context Health page, so the page reports "No workspaces have context instruction files" and an agentic readiness of 0 even when the projects are well configured. resolveWorkspaceRoot routes claude-* ids to resolveClaudeRoot, which expects ~/.claude/projects/<encoded> and reads cwd out of the first .jsonl line. But ws.path is already the project root, exactly as it is for codex-* and opencode-* ids. readdirSync finds no .jsonl there, the helper returns null, and buildWorkspaceHealth discards the workspace. Only Claude is affected: the other CLI harnesses take the existsSync branch and resolve correctly. Use ws.path when it is a real project directory, keeping the session file lookup as a fallback for paths that do still point at a Claude session store. Both branches now reject paths that do not exist. On a real log set this takes Context Health from 1 usable workspace to 7, the overall score from 7/100 to 34/100, agentic readiness from 0 to 30, and correctly reports 4 of 7 workspaces as having instruction files.
github-actions
Bot
requested review from
TamasBoncz,
Aymen (aymenfurter) and
Sanjay Singh (san360)
September 21, 2026 02:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Context Health page discards every Claude workspace, then reports conclusions drawn from whatever is left. On a real log set it showed:
Overall Score 7/100,Agentic Readiness 20/1001 Active Workspaces,0/1 With Context FilesNone of that was true. The same machine has
CLAUDE.md/AGENTS.mdin four separate projects.resolveWorkspaceRootinsrc/core/config-health-helpers.tsroutesclaude-*ids toresolveClaudeRoot(ws.path), which expects~/.claude/projects/<encoded>/and parsescwdout of the first.jsonlline. Butws.pathis already the project root — the same thingcodex-*andopencode-*ids get, and those take thefs.existsSyncbranch and resolve fine:readdirSyncfinds no.jsonlin a project root, the helper returnsnull,getWorkspaceAnalysisContextreturnsnull, andbuildWorkspaceHealthdrops the workspace. Nothing is logged, so the page presents a near-empty sample as a finished score.Only Claude is affected.
Fix
Use
ws.pathwhen it is a real project directory, and keepresolveClaudeRootas the fallback for paths that genuinely point at a Claude session store. A smallisProjectRoothelper distinguishes the two and also makes both branches reject paths that no longer exist — previously the codex/opencode branch did anexistsSyncwhile the Claude branch had no equivalent guard.Impact
Measured on the same log set, before → after:
The surviving workspaces now scan correctly, e.g.
reconreportsAGENTS.md, CLAUDE.md, .claude/skills/playwright-cli/SKILL.md, .claude/settings.local.json.Testing
Three unit tests added:
ws.pathalready a project root, the legacy session-store path still resolving viacwd, and a non-existent path returningnull. Verified the first fails against the old implementation (1 failed / 38 passed) and all pass with the fix (39 passed).npm run typecheckandnpm run lintclean (0 errors); 62 config-health and analyzer-config tests pass.