bug: MCP analyze ignores workspace scoping; health kind also ignores an explicit repo target
Summary
MCP analyze results are not scoped to the session's bound workspace: with the default one-workspace-per-repo layout, unscoped calls return symbols from all tracked repos. Passing target {repo: "<name>"} fixes it for some kinds (clones, dead_code) but the health kind ignores the repo selector entirely — in both name and path form — while accepting it without error.
The CLI is not affected: gortex analyze --kind health_score run from a repo cwd scopes correctly. So the graph and analyzers can scope; the MCP facade is what loses the binding.
Environment
- daemon
v0.61.1+89263194, linux/amd64, go1.26.5, systemd user unit - 14 tracked repos, default workspaces (one per repo, no shared
workspace:declarations) - MCP session bound to repo
vault-stack—workspace(operation:"active_project")returnsbound: true, project: vault-stack, workspace: vault-stack - v0.61.4's release notes don't mention this area; happy to retest on latest if you expect it's fixed
Reproduction
-
Unscoped
analyzeis global, not workspace-bound. From the session bound tovault-stack(a ~50-symbol bash repo):analyze kind=health → {"symbol_count":4393, ..., "worst_symbols":[ {"id":"tradebot::stdlib::time::time", ...}, {"id":"scripts/media/encoder.py::encoder_thread", ...}, {"id":"tradebot/bot/backtest.py::run_momentum", ...}]}Every worst symbol is from a different tracked repo.
analyze kind=cloneslikewise returns clusters fromgortex-web,tradebot,whatdowewatch,rivalbot— none from the bound repo. -
healthignores an explicit repo target. Both forms return the identical 4393-symbol global result:analyze kind=health target={"repo": "vault-stack"} analyze kind=health target={"repo": "/home/tyler/projects/vault-stack"}No error — the selector is accepted and silently ignored. (An invalid selector key is rejected with
unknown target selector, so the target is being parsed.) -
The selector works for other kinds, which is what isolates the bug to
health:analyze kind=clones target={"repo": "vault-stack"} → 0 clusters (correct for this repo) -
CLI control. From the repo's directory:
gortex analyze --kind health_score --format json → 47 symbols, all vault-stack (correct)
Expected
- MCP
analyzewith no target should default to the session's bound workspace, matching CLI behavior (or at minimum the docs should say it's global). - Every kind should honor
target.repo; accepting the selector and ignoring it is the worst combination, since results look plausible until a foreign path shows up.
Possibly related
- The MCP and CLI kind lists have diverged: MCP exposes
healthandclones; the CLI exposeshealth_scoreand has noclones. If MCPhealthis a distinct global aggregator rather than a facade overhealth_score, that would explain repro 2 — but it silently acceptingtarget.repostill seems wrong. - #322 (
analyze kind=routesmixes fields) may share plumbing but describes field attribution, not scope.