Add MCP bounty attempt visibility#333
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a centralized helper to list bounty attempts, updates the REST handler to use it, exposes the same payload via a new MCP tool ( ChangesList bounty attempts feature
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/main.py`:
- Around line 1699-1707: The list_bounty_attempts branch currently returns the
Python dict from bounty_attempts_to_dict directly; update this branch in the
list_bounty_attempts handling so it returns a JSON string (consistent with other
handlers like list_bounties/get_bounty/register_wallet) by calling json.dumps on
the result of bounty_attempts_to_dict (preserving include_expired via
optional_bool_arg and the Bounty lookup via session.get(Bounty,
positive_int_arg("bounty_id"))), ensuring the returned payload is serialized the
same way as the other MCP endpoints.
In `@docs/api-examples.md`:
- Line 465: The response JSON-RPC examples for the "tools/call" requests
(specifically the transfer example and the get_proof example) have mismatched id
fields; update the response snippets so their "id" values match the renumbered
request ids used in the corresponding request lines (e.g., ensure the transfer
response uses the same id as its transfer request and the get_proof response
uses the same id as its get_proof request) so request/response IDs are
consistent within each example flow.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3441308c-31aa-4ba7-9b5e-4ab192ea4f27
📒 Files selected for processing (5)
app/main.pyapp/mcp.pydocs/agent-guide.mddocs/api-examples.mdtests/test_bounty_attempts.py
| if name == "list_bounty_attempts": | ||
| bounty = session.get(Bounty, positive_int_arg("bounty_id")) | ||
| if bounty is None: | ||
| return "bounty not found" | ||
| return bounty_attempts_to_dict( | ||
| session, | ||
| bounty, | ||
| include_expired=optional_bool_arg("include_expired"), | ||
| ) |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial | 💤 Low value
Consider JSON-serializing the return value for consistency.
Most MCP tools in this handler return json.dumps(...) (see list_bounties at line 1690, get_bounty at 1698, register_wallet at 1717, etc.), but this tool returns the dict directly. While the function signature allows both, maintaining consistency would make the codebase easier to follow.
📐 Suggested change for consistency
if name == "list_bounty_attempts":
bounty = session.get(Bounty, positive_int_arg("bounty_id"))
if bounty is None:
return "bounty not found"
- return bounty_attempts_to_dict(
+ return json.dumps(bounty_attempts_to_dict(
session,
bounty,
include_expired=optional_bool_arg("include_expired"),
- )
+ ))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/main.py` around lines 1699 - 1707, The list_bounty_attempts branch
currently returns the Python dict from bounty_attempts_to_dict directly; update
this branch in the list_bounty_attempts handling so it returns a JSON string
(consistent with other handlers like list_bounties/get_bounty/register_wallet)
by calling json.dumps on the result of bounty_attempts_to_dict (preserving
include_expired via optional_bool_arg and the Bounty lookup via
session.get(Bounty, positive_int_arg("bounty_id"))), ensuring the returned
payload is serialized the same way as the other MCP endpoints.
TateLyman
left a comment
There was a problem hiding this comment.
Reviewed PR #333 against Bounty #321. The implementation is read-only and the MCP handler path preserves the existing active-attempt filtering semantics from the REST endpoint.
What I checked:
list_bounty_attemptsis registered inMCP_TOOLSand exposed bytools/list.- The MCP call uses the shared
bounty_attempts_to_dict(...)helper, so active attempts,include_expired, ordering, and warnings match the REST behavior. - Returning a dict here is intentional under the current MCP wrapper:
_tool_result_responseturns dict results into bothcontent[0].textandstructuredContent. JSON-serializing it would remove the structured MCP payload covered by the new test. - Unknown bounty and invalid
include_expiredinputs are covered.
One small docs issue remains: in docs/api-examples.md, after renumbering the request ids, the response examples still show the old JSON-RPC ids. The transfer response should use id: 7, and the get_proof response should use id: 6. That is documentation-only; I did not find a runtime blocker.
Validation I ran locally:
uv run --extra dev python -m pytest tests/test_bounty_attempts.py tests/test_api_mcp.py::test_mcp_tools_list_and_call -q-> 5 passeduv run --extra dev python -m pytest tests/test_bounty_attempts.py tests/test_api_mcp.py tests/test_docs_public_urls.py -q-> 94 passeduv run --extra dev ruff check app/main.py app/mcp.py tests/test_bounty_attempts.py-> passeduv run --extra dev ruff format --check app/main.py app/mcp.py tests/test_bounty_attempts.py-> passeduv run --extra dev python -m mypy app/main.py app/mcp.py-> passeduv run --extra dev python scripts/docs_smoke.py-> docs smoke okgit diff --check-> clean
GitHub state at review time: mergeState CLEAN, hosted quality check successful, CodeRabbit status successful.
|
Maintainer update: closing this as duplicate/rejected after PR #334 merged for the #321 MCP attempt-inspection slot. The PR review at #333 (review) was useful because it identified an actionable docs mismatch, so that review was paid separately from review round #340. No PR bounty payout is due for this duplicate PR. |
Bounty #321
/claim #321
Summary
list_bounty_attemptsMCP tool so agents can inspect active advisory attempts and warnings before opening overlapping PRs.This is read-only MCP visibility. It does not create payments, claim acceptance, mutate ledger balances, register attempts, or release attempts.
Validation
uv run --extra dev python -m pytest tests/test_bounty_attempts.py tests/test_api_mcp.py::test_mcp_tools_list_and_call -q-> 5 passeduv run --extra dev python -m pytest tests/test_bounty_attempts.py tests/test_api_mcp.py tests/test_docs_public_urls.py -q-> 94 passeduv run --extra dev python -m pytest -q-> 319 passeduv run --extra dev ruff check .-> passeduv run --extra dev ruff format --check .-> 46 files already formatteduv run --extra dev python -m mypy app-> successuv run --extra dev python scripts/docs_smoke.py-> docs smoke okgit diff --check-> cleanNo private keys, seed material, secrets, private vulnerability details, deployment credentials, wallet addresses, or price claims are included.
Summary by CodeRabbit
New Features
Documentation
Tests