Skip to content

fix(queue): prevent stale gate auto-maintenance#1489

Merged
JSONbored merged 4 commits into
mainfrom
codex/fix-merge-concurrency-issue-in-pr-handling
Jun 27, 2026
Merged

fix(queue): prevent stale gate auto-maintenance#1489
JSONbored merged 4 commits into
mainfrom
codex/fix-merge-concurrency-issue-in-pr-handling

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • Concurrent self-host queue workers can make a stale gate verdict (computed for an older reviewed head) be combined with a newer stored PR head, enabling an auto-merge of unreviewed code; this change prevents that unsafe pairing.

Description

  • Add agentMaintenanceHeadMatchesGate(reviewedHeadSha, currentHeadSha) to centralize the head-SHA consistency check in src/queue/processors.ts.
  • Short-circuit maybeRunAgentMaintenance when the stored PR headSha no longer matches the head that produced the gate verdict so agent maintenance is skipped on mismatch.
  • Add unit tests for the new helper covering matching, mismatched, and legacy no-SHA fail-open cases in test/unit/queue.test.ts.
  • Files changed: src/queue/processors.ts and test/unit/queue.test.ts.

Testing

  • Ran focused unit tests for the new helper and related guard with npx vitest run test/unit/queue.test.ts -t "agentMaintenanceHeadMatchesGate|changedPathsForGuardrail", and the targeted tests passed.
  • Ran npm run typecheck and it completed with no type errors.
  • Attempted the full local gate (npm run test:ci) but the run could not fully complete in this environment due to external network/DNS-dependent tooling (actionlint setup fallback / npm audit returning 403) and some long-running queue-sweep tests timing out; many unit/integration suites executed successfully but the full gate could not be validated end-to-end here.

Codex Task

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 26, 2026
@superagent-security

Copy link
Copy Markdown

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.38%. Comparing base (9e1c351) to head (08674b9).
⚠️ Report is 4 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1489   +/-   ##
=======================================
  Coverage   95.38%   95.38%           
=======================================
  Files         201      201           
  Lines       21598    21600    +2     
  Branches     7807     7809    +2     
=======================================
+ Hits        20601    20603    +2     
  Misses        416      416           
  Partials      581      581           
Files with missing lines Coverage Δ
src/queue/processors.ts 87.44% <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 self-assigned this Jun 26, 2026
@JSONbored JSONbored added the gittensor:bug Gittensor-scored bug fix - worth 0.5x multiplier. label Jun 26, 2026
@JSONbored JSONbored force-pushed the codex/fix-merge-concurrency-issue-in-pr-handling branch from 8a34dde to f7c87b3 Compare June 26, 2026 20:58
@gittensory-orb

gittensory-orb Bot commented Jun 27, 2026

Copy link
Copy Markdown

Warning

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

⏸️ Gittensory review — held for maintainer review

2 files · 1 AI reviewers · no blockers · readiness 55/100 · CI green · blocked

⏸️ Held for maintainer review

Signal Result Evidence
Code review ✅ No blockers 1 reviewers, synthesized
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.
Review load ❌ 8/20 Readiness component derived from cached public PR metadata and labels; size label size:XS.
Validation evidence ❌ 5/25 Cached preflight status is hold.
Open PR queue ❌ 3/10 48 open PR(s), 9 likely reviewable, 39 unlinked.
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 81 PR(s), 261 issue(s).
Gate result ✅ Passing No configured blocker found.
Nits — 2 non-blocking
  • Repository config was not parsed
  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
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: 81 PR(s), 261 issue(s).
  • Related work: Titles/paths share 8 meaningful terms. (PR #1427)
  • Related work: Titles/paths share 6 meaningful terms. (PR #1441)
  • Related work: Titles/paths share 6 meaningful terms. (PR #1492)
  • 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 scope summary.
  • Fix blocker.
  • Expect slower review.
  • Refresh registry data or choose a registered active repo.
  • 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.
  • Review load = cached public PR metadata such as size labels, changed paths, and preflight status.
  • Open PR queue = repo-wide review pressure; it is not a PR 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

@gittensory-orb gittensory-orb Bot added the gittensor Gittensor contributor context label Jun 27, 2026
@JSONbored JSONbored merged commit ad383cc into main Jun 27, 2026
19 checks passed
@JSONbored JSONbored deleted the codex/fix-merge-concurrency-issue-in-pr-handling branch June 27, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark codex gittensor:bug Gittensor-scored bug fix - worth 0.5x multiplier. gittensor Gittensor contributor context size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant