Repository navigation
[2798 by Claude Opus 5.5] Expose Repository Search and Read as Composable MCP Tools with Policy Authorization - #2833
Conversation
|
/ultrafix |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-dev[bot] Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR exposes repository search and file reads through MCP using the existing retrieval service. It needs minor changes before merge: the new test supplies an incomplete policy dependency, preventing its executor assertion from testing the intended behavior. ✅ Authorization before retrieval — Both tools check repository access before invoking the retrieval service and forward the caller’s token. ✅ Bounded and validated reads — The implementation validates paths, rejects reversed line ranges, and passes explicit line and byte limits to the service. This review used static analysis only, as requested. Current checks report 13 neutral/skipped results, with none passed, pending, or failed. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Complete the executor test’s policy dependency
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Clarify the cloning descriptionThe S2: 🟢 Test serialized response limitsConsider testing reads through the executor near its 256 KiB JSON limit. The new schema permits ScoreThe implementation is focused and reuses established authorization and retrieval behavior, but the new test has a deterministic dependency error. Current checks provide no passing validation evidence. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit be85bd3
Summary of ChangesI fixed F1. The test now runs the executor with the real policy, and its final traversal call produces the standard What changed (only
Checking for the same mistake elsewhere: the other MCP tests that fake a policy already provide Verification: Separate findings, not changed:
🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
…licy, and its final traversal call produces the standard `INVALID_PATH` envelope. The test passes.
I fixed F1. The test now runs the executor with the real policy, and its final traversal call produces the standard `INVALID_PATH` envelope. The test passes.
**What changed** (only `packages/api/test/mcpRepositoryRetrieval.test.ts`):
- **Policy dependency:** the stub that only had `repository` is gone. The test now uses `Object.create(McpPolicy.prototype)`, so the executor calls the real `requireScope`, `requirePermission` and `repository` methods. It skips the constructor, which only sets up OAuth/JWKS state these methods don't use.
- **A second error in the same assertion:** with the policy fixed, the last call still failed. `executeTool` doesn't return an error envelope; it throws. The envelope is built one layer up, in `packages/api/mcp/server.ts:65`, via `toToolErrorResult(classifyError(error, …))`. The test now runs a rejected `executeTool` call through that same conversion. It checks that a traversal path gives `{ code: 'INVALID_PATH', status: 400 }`.
- **New regression checks:**
- A caller without the `read` scope gets an `INSUFFICIENT_SCOPE` envelope from the executor. This proves the scope check really runs.
- Neither executor call reaches the file-read service.
**Checking for the same mistake elsewhere:** the other MCP tests that fake a policy already provide `requireScope`. This was the only executor test in the PR with an incomplete policy.
**Verification:** `NODE_ENV=test npx tsx --experimental-test-module-mocks --test --test-force-exit packages/api/test/mcpRepositoryRetrieval.test.ts` passes (1/1). With the old stub, the final call would fail with a `TypeError` instead of `INVALID_PATH`.
**Separate findings, not changed:**
- Run without `--test-force-exit`, the test file passed nothing and was killed after 300s by my timeout. Something seems to keep the process open, probably the SQLite connection it opens. I didn't check whether this happens on the code before my change. This file also isn't in the `test:mcp` script list.
- The run prints `[mcp] Access log write failed: db is not a function` because `deps.db` is an empty stub. The executor catches and logs this, so the test still passes.
- ESLint ignores `packages/api/test`, and the api `tsconfig.json` doesn't include test files, so neither lint nor `tsc` covered this file. It does run cleanly under `tsx`.
PR: #2833
Comment by: @propr-ultrafix (ID: 0)
Model: Claude Opus 5.5
|
⏳ Ultrafix is waiting for CI before the next These blocking checks on
Checks matching this repository's non-blocking checks never gate Ultrafix. The loop continues automatically once the blocking checks pass; if they have not settled within 2 hours, Ultrafix stops. |
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR exposes repository search and bounded file reads through MCP using the existing retrieval services. The implementation is focused and merge-ready within the supplied scope, conditional on the four pending test shards completing successfully. No current checks are reported as failed. ✅ Authorization before retrieval — Both handlers check repository access before invoking retrieval, and tests cover ungranted, disabled, and GitHub-inaccessible repositories. ✅ Bounded reads and validation — Read schemas constrain line and byte limits, reject reversed ranges, and preserve the service’s continuation metadata. Traversal inputs are rejected before retrieval. This assessment is based on static inspection of the supplied diff and surrounding code; no commands or tests were run. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S3: 🟢 Test successful executor responsesThe new tests exercise successful requests through S4: 🟢 Cover remaining error mappingsConsider testing retrieval errors with statuses 403, 413, and 500, plus invalid-ref errors. The wrapper explicitly maps these cases, while the added tests primarily cover binary files, missing files, directories, and missing refs. These are optional coverage improvements rather than demonstrated correctness problems. ScoreThe focused implementation correctly connects authorization, validation, and existing retrieval contracts, with useful regression coverage. Static review found no merge blockers; the four full-suite shards remain pending. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
Full Test Suite ResultsValidation failed during: Test shard (shard 3).
View shard 3/4 outputDetails truncated; see the uploaded artifacts for complete failure rows and logs. |
|
✅ Applied the requested follow-up changes in commit 6336016 Summary of ChangesI fixed the shard 3 timeout. The fix: the test now imports Checked locally, without
I only ran this one file, not the full shard. The shard also warned that There is no visual change, so no previews were made. 🤖 Implementation Details
Undo Changes • View Task Execution 💡 ProPR Slash Commands
🤖 Generated by ProPR |
…ryRetrieval.test.ts` passed but never exited. Using the executor opened the core SQLite connection, and nothing closed it, so the process stayed alive until CI's 180s limit killed it. I fixed the shard 3 timeout. `packages/api/test/mcpRepositoryRetrieval.test.ts` passed but never exited. Using the executor opened the core SQLite connection, and nothing closed it, so the process stayed alive until CI's 180s limit killed it. **The fix:** the test now imports `closeConnection` from `@propr/core` and calls it in `after(async () => closeConnection())`. The neighbouring MCP tests, like `mcpRepositoryConsent.test.ts` and `mcpAccessLogDispatch.test.ts`, close the connection the same way. No other file changed. **Checked locally**, without `--test-force-exit`, which is closer to how CI runs it: - **Before:** a copy of the previous version still hadn't exited at a 40s timeout (exit code 124). - **After:** the test passes 1/1, logs "SQLite database connection closed", and the process exits in about 3.5s. I only ran this one file, not the full shard. The shard also warned that `test/taskIntentWithdrawal.test.ts` passed but used 85% of its time limit (152.9s of 180s). This PR doesn't touch it. There is no visual change, so no previews were made. PR: #2833 Comment by: @github-actions[bot] (ID: 6019780816) Model: Claude Opus 5.5
7b8467b
into
2797-epic-repository-search-sgj
AI Implementation Summary
Closes #2798
Branch:
2798/claude-opus-5-5-expose-repository-search--20261006-1503-b8hCommits: ✅ Changes committed (57bec4a)
AI Processing Completed
Execution Details:
Summary:
The watcher I started will notify me when the test finishes, so I'll wait for that.
Detailed Logs:
9aaace86-06fd-47ac-9635-bc301d377cd4Log files stored at:
/tmp/claude-logs/issue-2798-2026-10-06T15-09-24-128Z-conversation.json/tmp/claude-logs/issue-2798-2026-10-06T15-09-24-128Z-output.txtLatest Conversation Messages
This PR was created automatically by ProPR after processing issue #2798.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!