Skip to content

Scope MCP work proof by repo#349

Closed
TUPM96 wants to merge 1 commit into
ramimbo:mainfrom
TUPM96:codex/bounty-315-repo-selector
Closed

Scope MCP work proof by repo#349
TUPM96 wants to merge 1 commit into
ramimbo:mainfrom
TUPM96:codex/bounty-315-repo-selector

Conversation

@TUPM96
Copy link
Copy Markdown
Contributor

@TUPM96 TUPM96 commented May 26, 2026

Refs #315

Summary

  • Allow submit_work_proof callers to pass repo with issue_number so duplicate issue numbers across repositories resolve to the intended bounty.
  • Keep bounty_id behavior and generic guidance unchanged while rejecting unsupported repo selector combinations.
  • Update MCP tool metadata and targeted MCP tests for structured JSON guidance.

Tests

  • python -m pytest tests/test_api_mcp.py -q
  • python -m ruff format --check app/main.py app/mcp.py tests/test_api_mcp.py
  • python -m ruff check app/main.py app/mcp.py tests/test_api_mcp.py

Summary by CodeRabbit

  • New Features
    • The work proof submission tool now accepts an optional repository parameter, enabling users to specify which repository their bounty is associated with. This feature resolves disambiguation issues when the same issue number exists across multiple repositories, improving submission accuracy and clarity. Submission instructions have been updated to reflect this new capability.

Review Change Stack

Copilot AI review requested due to automatic review settings May 26, 2026 01:23
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The PR extends the submit_work_proof MCP tool to support optional repository-based disambiguation. When multiple bounties share the same issue_number across different repositories, the tool now accepts an optional repo parameter to select the correct bounty. Validation enforces that repo can only be used with issue_number and rejects conflicting selector combinations.

Changes

Repository selector for work proof submission

Layer / File(s) Summary
Argument validation and normalization
app/main.py
New optional_repo_selector_arg helper validates, normalizes, and enforces a 200-character maximum on the optional repo argument. Tool argument validation rejects cases where both bounty_id and issue_number are set, and restricts repo usage to issue_number-based requests.
Repository-filtered bounty lookup
app/main.py
The issue_number-based bounty query is extended to filter by repo using case-insensitive equality when the repository selector is provided, enabling correct bounty selection across multiple repositories.
Tool description update
app/mcp.py
The submit_work_proof tool description documents the optional repo parameter, explains the mutual exclusivity constraints between bounty_id, issue_number, and repo, and notes JSON output format support.
Repository disambiguation and validation tests
tests/test_api_mcp.py
New test verifies that submit_work_proof with issue_number plus repo selector correctly disambiguates and returns the matching bounty's structured guidance. Existing parametrized validation test is extended with cases covering invalid repo combinations and format constraints.

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly Related PRs

  • ramimbo/mergework#287: Both PRs modify the submit_work_proof MCP tool implementation and its issue_number-based bounty disambiguation/validation in app/main.py (with tests in tests/test_api_mcp.py), where the main PR extends the retrieved PR's selector/ambiguity logic by adding an optional repo filter to select the correct bounty.
  • ramimbo/mergework#323: Both PRs modify app/main.py's MCP tool handling for submit_work_proof inside _call_mcp_tool (main adds repo-based selector validation/disambiguation, retrieved adds integer-argument bounds and error behavior), so the changes intersect at the same tool-argument validation layer.

Suggested Reviewers

  • TateLyman
  • weilixiong
  • g8rr5dg2p7-svg
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Scope MCP work proof by repo' directly describes the main change: adding repo-based scoping to the MCP submit_work_proof tool to resolve duplicate issue numbers across repositories.
Description check ✅ Passed The description includes all major required sections (Summary, Evidence via Tests, and related issue reference #315), clearly explaining the feature change and testing approach.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for scoping submit_work_proof lookups by repo when selecting a bounty via issue_number.

Changes:

  • Add optional repo selector argument handling (validation + query filter) for MCP submit_work_proof when using issue_number.
  • Update MCP tool description to mention repo and output format.
  • Expand tests to cover repo-scoped selection and invalid repo selector inputs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
tests/test_api_mcp.py Adds coverage for repo-scoped issue_number lookups and new invalid selector cases.
app/mcp.py Updates MCP tool metadata description to reflect new selector behavior.
app/main.py Implements optional repo selector parsing and applies it to the issue_number bounty query.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/main.py
if repo is None:
return None
if len(repo) > 200:
raise ValueError("repo is too long")
Comment thread app/mcp.py
Comment on lines +42 to +43
"Return submission instructions, optionally for a bounty_id or issue_number "
"and repo, with text or json format"
Comment thread app/main.py
Comment on lines +1782 to +1787
issue_query = select(Bounty).where(
Bounty.issue_number == positive_int_arg("issue_number")
)
if repo_selector is not None:
issue_query = issue_query.where(func.lower(Bounty.repo) == repo_selector)
bounties = session.scalars(issue_query.order_by(Bounty.id.desc()).limit(2)).all()
@TUPM96
Copy link
Copy Markdown
Contributor Author

TUPM96 commented May 26, 2026

Superseded by #351, which keeps the repo-scoped MCP guidance change in one focused PR.

@TUPM96 TUPM96 closed this May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants