Opus finding
Cron sweep counts outgoing-PR poll failures only when getUpstreamPrState throws, not when GitHub returns inconsistent merged-without-sha state
- apps/web/lib/outgoing-prs.ts:98-129
- apps/web/lib/outgoing-prs.test.ts:119-146
When GitHub returns merged=true, mergedAt set, but merge_commit_sha=null (which happens transiently — GitHub finalizes merge_commit_sha after the merge event), the current logic falls through to markClosed because state.state==='closed'. This persistently marks the PR as declined ('closed-without-merge', honest-report says 'not surfaced publicly'), permanently losing the receipt unless an operator manually inspects. The unit test even encodes this as intended behavior, but the underlying data-loss risk is real: a real merge will be recorded as a decline. POLL_INTERVAL_MS is 1 hour; once status='closed' the row no longer matches loadOpenPrs's status='open' filter and will never be re-polled.
Recommendation
When merged=true but mergeSha is null, treat as unchanged (stampPolled only) so a subsequent poll picks up the finalized SHA. Only transition to 'closed' when merged=false AND state=='closed'.