Skip to content

bug: MCP analyze ignores workspace scoping; health kind also ignores an explicit repo target #349

Description

@tydude001

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-stackworkspace(operation:"active_project") returns bound: 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

  1. Unscoped analyze is global, not workspace-bound. From the session bound to vault-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=clones likewise returns clusters from gortex-web, tradebot, whatdowewatch, rivalbot — none from the bound repo.

  2. health ignores 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.)

  3. 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)
    
  4. CLI control. From the repo's directory:

    gortex analyze --kind health_score --format json     → 47 symbols, all vault-stack (correct)
    

Expected

  • MCP analyze with 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions