refactor(mcp): align catalog with explicit capability boundaries - #293
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a99ac5cfb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| threadState = "all" | ||
| } | ||
| threads, err := c.ListPullRequestsWithIncompleteFeedback(ctx, repositoryID, channels, threadState, 50) | ||
| threads, err := c.ListPullRequestsWithIncompleteFeedback(ctx, repositoryID, channels, threadState, maxExactFeedbackPullRequests) |
There was a problem hiding this comment.
Scope incomplete-feedback recovery to the requested state
When a search is scoped to state=open or state=closed, page.Coverage.IncompletePRs is calculated only for that state, but this recovery query still lists incomplete PRs from every state. Because the list is ordered and capped at 100, unrelated closed PRs can fill the recovery batch for an open-only search, leaving the PRs responsible for the partial result unsynchronized on every retry. Pass the requested PR state into this query or filter its results accordingly.
AGENTS.md reference: AGENTS.md:L12-L16
Useful? React with 👍 / 👎.
| next := request.canonical | ||
| next.SnapshotToken = "" | ||
| if out.Truncated { | ||
| next.CandidateLimit = min(100, max(next.CandidateLimit*2, next.CandidateLimit+1)) |
There was a problem hiding this comment.
Make capped fix-pattern recovery advance
If a symptom matches more than 100 PRs, CandidateLimit is already at its allowed maximum, so this expression leaves it at 100 and the returned recovery action reruns the identical truncated analysis. With complete history and no unknown outcomes, that rerun is the only action and can never make progress. Provide pagination or a narrowing recovery, or avoid advertising an unchanged rerun at the cap.
AGENTS.md reference: AGENTS.md:L48-L49
Useful? React with 👍 / 👎.
| if out.Truncated { | ||
| out.Status = "partial" | ||
| next := freshCandidateRankingInput(in) | ||
| next.Limit = min(100, max(in.Limit*2, in.Limit+1)) |
There was a problem hiding this comment.
Avoid a no-op recovery at the ranking limit
When the caller already requests limit=100 and more candidates exist, out.Truncated is true but this recovery leaves next.Limit at the maximum of 100. After the header sync, the prescribed rerun has the same bounds and remains truncated indefinitely for a stable repository. The recovery should offer a progressing strategy, such as narrowing the repository set/query, rather than replaying an unchanged capped request.
AGENTS.md reference: AGENTS.md:L48-L49
Useful? React with 👍 / 👎.
Description
The MCP catalog had two conflicting models at once: composable fact and acquisition tools were the intended public boundary, while older workflow-shaped operations still bundled reads, network hydration, local writes, verdicts, jobs, and bespoke artifacts. A removal shim hid several of those tools without completing their migrations, leaving dossier generation unreachable and discarding useful offline analysis.
This refactor makes the catalog match its capability boundaries:
corpus.materialize_repository_dossierand returns a followable dossier resource;corpus.analyze_fix_patterns, with storage-free classification, bounded proof-style detection, coverage, limitations, and typed acquisition recovery;corpus.rank_contribution_candidatesthrough the application-owned Contribution Radar service;corpus.search_codethe bounded canonical single-query and batch route;PullRequestReviewComment;The documentation now has one current MCP guide instead of separate migration, redesign, scalable-workflow, and composition narratives. The runbooks were also corrected to use supported CLI behavior.
Behavior and compatibility
This intentionally removes the public composite routes
workflow.prepare_issue_set,workflow.preflight_contribution,workflow.find_related_work,workflow.build_repository_dossier,workflow.mine_repository_fix_patterns,corpus.preview_fix_patterns, and the legacy scalar code-search alias. There are no compatibility aliases, consistent with the repository's architecture contract.No GitHub mutation capability is added. Fix-pattern analysis and candidate ranking remain offline reads; dossier materialization is an honestly annotated local write. No issue-evidence aggregate is added without controlled evidence that clients repeatedly lose coverage or provenance during composition.
Suggested review order
internal/mcpcontract,internal/fixpatterns, andinternal/radarfor the public contracts and storage-free computation.internal/app/mcp_fix_pattern_analysis.go,internal/app/mcp_radar.go, andinternal/app/mcp_github_identity.gofor side-effect ownership and recovery.internal/mcpserverfor registration, annotations, schemas, and resource routing.docs/mcp.md,docs/architecture.md, anddocs/runbooks.mdfor the resulting public contract.Testing
make verifypassesmake test-racepasses for storage, concurrency, locking, or cancellation changesAdditional documentation checks included local Markdown target validation and stale-reference scanning.
Compatibility and scope