Skip to content

Fix/solved issue can become stale#61

Closed
jonathanchang31 wants to merge 2 commits into
entrius:testfrom
jonathanchang31:fix/solved_issue-can-become-stale
Closed

Fix/solved issue can become stale#61
jonathanchang31 wants to merge 2 commits into
entrius:testfrom
jonathanchang31:fix/solved_issue-can-become-stale

Conversation

@jonathanchang31
Copy link
Copy Markdown

Summary

This update improves mirror reliability and scoring correctness by fixing:

  1. Webhook deduplication race for identical x-github-delivery.
  2. Stale issues.solved_by_pr links after PR closing-reference changes.

Related Issue

Fixes: #59

Change Type (select all)

  • Bug fix
  • Concurrency/race-condition fix
  • Data consistency fix
  • Reliability improvement
  • Backend logic update
  • DB schema update
  • Breaking change
  • API contract change

Changes Implemented

  1. Webhook delivery lease model:
  • Added processing_started_at to webhook_deliveries.
  • Atomic claim/reclaim query in claimDelivery().
  • markProcessed() now clears lease.
  • releaseDelivery() on handler failure to allow immediate retry.
  1. solved_by_pr reconciliation:
  • Read previous issue links before metadata update.
  • Compute removed links and clear stale mappings.
  • Set current links when PR is merged.
  • Clear this PR as solver when PR is not merged.

Real Behavior Proof

Before:

  1. Two concurrent webhook posts with same delivery ID could both execute handlers.
  2. After merging PR with Fixes #123, editing PR body to remove link left issues.solved_by_pr still pointing to old PR.

After:

  1. Only one request can hold active claim for a delivery; others skip unless stale-lease reclaim conditions are met.
  2. Metadata refresh clears removed stale issue mappings and re-applies only valid current merged links.

@xiao-xiao-mao xiao-xiao-mao Bot added the bug Something isn't working label May 12, 2026
@anderdc
Copy link
Copy Markdown
Collaborator

anderdc commented May 13, 2026

The webhook_deliveries lease / processing_started_at change conflicts with the documented design contract — webhook reprocessing is intentional, all handlers are upserts so same-delivery-id retries are safe, and the named non-idempotent side-effect (label_events) is already being fixed at the write layer in #26. Closing. Issue #59 (stale solved_by_pr) remains open — the reconciliation fix can land in a separate PR without the lease changes.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] issues.solved_by_pr can become stale when PR closing references change after merge

2 participants