[Bug] MCP tools called without `repo` silently resolve to the workspace default_repo, not the caller's repo
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 40/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- python
- Domain
- ai-infra-agents, backend-api-design
Research direction
Start by tracing how MCP tool calls resolve an omitted repo parameter and how the server gets its default repository; the issue names repowise mcp, the workspace default_repo, and repo-scoped tools such as get_change_risk. Compare omitted and explicit repo calls, then add coverage for the chosen mitigation. Done means calls cannot silently return data from a different repository.
Written by the indexing model from the issue text.
Description
Summary
MCP tool calls that omit the `repo` parameter are answered from the workspace `default_repo` index (the serve anchor), not from the repository the caller is working in. The wrong-repo answer returns with no warning, so callers silently consume index data for a different repository.
Observed on repowise 0.61.0, `repowise mcp` running as a supervised long-running daemon, Windows 11.
Mechanism
- `repowise mcp ` is spawned once per machine against the workspace serve anchor (`.repowise-workspace.yaml` `default_repo`), so the daemon's env lookup and default scope sit on that repo.
- Tool calls carry an optional `repo` argument. Supplied → correct resolution. Omitted (`repo=None`) → the server falls back to the anchor/default. There is no per-session caller-cwd binding and no fail-closed behaviour.
- One daemon serves MCP clients started from many repos (agent/IDE sessions in any of the 17 workspace members), so "the caller's repo" is only recoverable from per-call context.
Reproduction / field evidence
- `get_change_risk` called without `repo` while the caller was working in repo A answered with repo B (the workspace default) — including another repo's HEAD. The same call with `repo='A'` resolved `origin/master..HEAD` correctly.
- Daemon child log carries `impacted_tests_head_start_failed` — `ValueError: unknown revision 'master'`, `'origin/master'`, `''` (~7 occurrences over 3 days): calls reaching the serve with a base/head revision valid in the caller's repo but absent from the resolved default repo — the same wrong-repo signature one layer down.
Impact
Any caller that forgets `repo` gets plausible-looking but wrong-repository data — a silent data-integrity failure, not an error. Change-risk, impacted-tests and risk findings can describe the wrong codebase.
Suggested fixes (any one mitigates)
- Fail closed: reject `repo=None` on repo-scoped tools with a clear "repo required" error; or
- Per-session binding: resolve the caller's repo from MCP session context (client cwd / initialize params); or
- Warn loudly: include `resolved_repo` + `repo_source: 'default'` in every response so clients can detect the fallback.
Local mitigation in place on our side: callers always pass `repo=` explicitly and verify the returned repo field before trusting the answer.
Related: #5334 covered which repo the daemon serves; this is the per-call resolution layer on top of it.
- Dominant language
- Python
- Stars
- 7.1k
- Forks
- 756
- Avg merge
- 21h 5m
- Merged PRs (30d)
- 797
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from repowise-dev/repowise
-
[Bug] Elixir `.formatter.exs`, `.credo.exs`, `config/*.exs` and `priv/**/*.exs` are reported as unreachable filesPossibly taken @ZYZ666-RGB claimed this 1 day ago. Openbug good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
repowise-dev/repowise#6296 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] Coverage stack detection omits Swift, Dart, and Scala, falling through to UNKNOWN in evidence setupPossibly taken @RishabhIIITD claimed this 2 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
repowise-dev/repowise#5838 · 2 comments ·
Maintainers usually reply within 1 day
-
[Bug] PR-mined decisions store the decision sentence again as their rationalePossibly taken @suyashgitt claimed this 11 days ago. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
repowise-dev/repowise#5702 · 2 comments ·
Maintainers usually reply within 1 day
-
[Bug] CICS CSD `DEFINE _PGMLIST` startup programs (`_PGMPH`) are not rootsPossibly taken @dchaudhari7177 claimed this 34 days ago. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
repowise-dev/repowise#4477 ·
Maintainers usually reply within 1 day
-
[Bug] COBOL listing directives EJECT, SKIP1/SKIP2/SKIP3 and TITLE fail to parse and drop the rest of the filePossibly taken @dchaudhari7177 claimed this 34 days ago. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
repowise-dev/repowise#4474 ·
Maintainers usually reply within 1 day
All issues in repowise-dev/repowise
Similar issues
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
kornia/kornia-rs#1416 · 1 comment ·
Maintainers usually reply within 2 days
-
ui
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
PolicyEngine/ai-inequality#64 ·
Maintainers usually reply within 1 day
-
LinearGaussianStateSpace.dist splits states and observations wrongly when the transition varies over timePossibly taken @PabloRoque claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
pymc-devs/pymc-extras#839 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day