Skip to content

fix(mcp): derive authoritative bounty status in bounties.list/get - #169

Open
aagear wants to merge 2 commits into
Ghbounty:mainfrom
aagear:fix/mcp-bounty-status-parity
Open

aagear wants to merge 2 commits into
Ghbounty:mainfrom
aagear:fix/mcp-bounty-status-parity

Conversation

@aagear

@aagear aagear commented Sep 13, 2026

Copy link
Copy Markdown

Problem

Issue #167 reports that MCP bounties.list shows all eight bounties as open with zero submissions, while the signed-in dashboard shows reviewing/capped/paid records with nonzero PR counts (e.g. bounty d232f106… capped, 1bd19d23… paid).

Root cause: bounties.list/bounties.get return the raw on-chain mirror columns, which lag reality:

  • issues.state only flips to resolved when the relayer runs (never on devnet), while the dashboard treats any submission_reviews.approved = true as already paid.
  • issues.submission_count lags forever because only the bounty creator can UPDATE it under RLS; the dashboard counts the live submissions table instead.
  • Cap-closed (bounty_meta.closed_by_cap_at) and manually closed (closed_by_user) bounties still read state = open.

Fix

Mirror the dashboard's deriveStatus (frontend/lib/data.ts) in the MCP:

  • New apps/mcp/lib/tools/bounties/status.ts: deriveBountyStatus() + fetchBountyEnrichment() (live submission counts per PDA and approved-submission flags, both soft-failing to the mirror column on error).
  • bounties.list / bounties.get now return a status bucket (open | reviewing | capped | closed | paid), the live submission_count, and chain_id — answering the "which supported endpoint exposes authoritative claimability and chain/network information" question from Authenticated MCP profile lacks existing wallet mapping; bounty state differs from dashboard #167.
  • filter.status now matches the derived bucket (legacy resolved/cancelled values still accepted, mapped to paid/closed), so status=open means actually claimable instead of "relayer hasn't run yet".

The wallet-mapping half of #167 (github_handle/wallet_pubkey null in whoami) is covered by the open PRs #141 and #140.

Testing

  • pnpm vitest run in apps/mcp: 56 passed (new cases: reviewing from live count, capped, paid via approved review, open-filter excludes reviewing)
  • pnpm typecheck clean

Fixes #167

aagear added 2 commits August 14, 2026 05:39
bounties.list/get reported the raw on-chain mirror (issues.state,
issues.submission_count), which lags reality: the relayer never flips
state=resolved on devnet and the frontend cannot update
submission_count under creator-only RLS. Mirror the dashboard's
deriveStatus: live submissions count, submission_reviews.approved flag,
bounty_meta.closed_by_user / closed_by_cap_at. Add derived status
bucket + chain_id to list/get responses and filter on the derived
bucket so status=open means actually claimable.

Fixes Ghbounty#167
@aagear
aagear requested a review from tomazzi14 as a code owner September 13, 2026 08:54
@vercel

vercel Bot commented Sep 13, 2026

Copy link
Copy Markdown

@aagear is attempting to deploy a commit to the weareghbounty-6269's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

Authenticated MCP profile lacks existing wallet mapping; bounty state differs from dashboard

1 participant