Skip to content

fix(queue): retry policy closes on PR lock contention - #2471

Merged
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-pr-locking-vulnerability
Jul 2, 2026
Merged

fix(queue): retry policy closes on PR lock contention#2471
JSONbored merged 1 commit into
mainfrom
codex/propose-fix-for-pr-locking-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Close a security/regression gap where routing normal maintenance through the shared per-PR actuation lock could cause converted_to_draft and reopened enforcement to be silently skipped when maintenance held the lock.
  • Ensure policy-specific one-shot closes are retried by the queue instead of being acknowledged as processed when the lock is contended by an unrelated maintenance pass.

Description

  • Add a new retryable error PrActuationLockContendedError and propagate it when claimPrActuationLock fails for policy enforcement paths so the queue will retry rather than record the webhook as processed. (src/queue/processors.ts)
  • Change maybeCloseDraftDodgeAttempt and maybeRecloseDisallowedReopen to throw the new error on lock contention instead of silently returning, and update comments to document the retryable behavior. (src/queue/processors.ts)
  • Remove the lock_contended enum path from ReopenRecloseOutcome, and make only an actual "reclosed" outcome short-circuit the normal webhook flow to avoid falling through to normal re-review when contention occurs. (src/queue/processors.ts)
  • Update unit tests to assert the new retryable behavior: contended converted_to_draft and reopened deliveries now reject with the lock-contended error and do not mutate GitHub or record a false audit; concurrent race tests assert exactly one success and one retryable failure. (test/unit/queue.test.ts)

Testing

  • Ran targeted unit tests: npx vitest run test/unit/queue.test.ts -t "draft-dodge|reopen-reclose" and broader unit suite affected by the changes; the modified tests passed (reopened/draft-dodge regression tests updated and green). ✅
  • Ran type checking: npm run typecheck succeeded with no errors. ✅
  • Attempted npm audit --audit-level=moderate but the registry audit endpoint returned 403 Forbidden in this environment, so audit could not complete here (environment issue, not code failure). ⚠️

Codex Task

@loopover-orb

loopover-orb Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-02 05:45:32 UTC

2 files · 1 AI reviewer · no blockers · readiness 75/100 · CI green · clean

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
The change correctly moves the draft-dodge and reopen-reclose lock-contended paths from silent skip/processed semantics to thrown retry semantics, so the queue can re-drive policy-specific one-shot enforcement instead of losing it behind unrelated maintenance. The visible call-site update also avoids treating contention as a completed reopen decision, and the tests cover the two direct contention cases plus the same-PR race shape. The main remaining issues are test precision and a stale comment, not a visible correctness break.

Nits — 5 non-blocking
  • nit: test/unit/queue.test.ts:12293 only asserts that one concurrent draft-dodge job rejects, but not that it rejects with the new lock-contended error, so an unrelated failure in the loser would still satisfy the regression test.
  • nit: src/queue/processors.ts:3761 still says every step inside maybeRecloseDisallowedReopen fails safe and is deliberately uncaught, but lock contention is now an intentional thrown retry signal rather than a fail-open/no-op path.
  • test/unit/queue.test.ts:12293 should assert the rejected result's reason matches `pr actuation lock contended` so the race test proves the intended retryable failure, not just any rejection.
  • src/queue/processors.ts:3761 should update the call-site comment to distinguish unexpected errors from the intentional `PrActuationLockContendedError` retry path.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ No-issue rationale PR body explains why no issue is linked.
Related work ⚠️ 3 scoped overlaps Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (size label size:M; no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 65 registered-repo PR(s), 55 merged, 554 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 65 PR(s), 554 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 65 PR(s), 554 issue(s).
  • Related work: Titles/paths share 6 meaningful terms. (PR #2470)
  • Related work: Titles/paths share 7 meaningful terms. (PR #2473)
  • Related work: Titles/paths share 6 meaningful terms. (PR #2470, PR #2476)
  • Additional title-only matches omitted; title-only overlap does not block.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Triage stale or unlinked PRs.
  • No action.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
  • Check active issues and PRs before submitting.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added gittensor gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. labels Jul 2, 2026
@JSONbored JSONbored self-assigned this Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.93%. Comparing base (f9662a7) to head (2ae0c14).
⚠️ Report is 31 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2471   +/-   ##
=======================================
  Coverage   95.93%   95.93%           
=======================================
  Files         225      225           
  Lines       25332    25336    +4     
  Branches     9217     9217           
=======================================
+ Hits        24302    24306    +4     
  Misses        417      417           
  Partials      613      613           
Files with missing lines Coverage Δ
src/queue/processors.ts 91.75% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JSONbored
JSONbored merged commit 357cf7a into main Jul 2, 2026
12 checks passed
@JSONbored
JSONbored deleted the codex/propose-fix-for-pr-locking-vulnerability branch July 2, 2026 05:49
@github-project-automation github-project-automation Bot moved this from Todo to Done in gittensory - v1 roadmap Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant