feat(review): merge-train FIFO gate for out-of-order merges#4035
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
gittensory-ui | 81cc01e | Commit Preview URL Branch Preview URL |
Jul 07 2026, 12:13 PM |
|
Caution 🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥🟥 🛑 Gittensory review result - fixes requiredReview updated: 2026-07-07 12:27:56 UTC
🛑 Suggested Action - Manual Review
Review summary Nits — 7 non-blocking
CI checks failing
Review context
Contributor next steps
Signal definitions
🟩 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.
|
a37a8b9 to
bf5cf2b
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4035 +/- ##
==========================================
- Coverage 93.58% 93.58% -0.01%
==========================================
Files 381 382 +1
Lines 35483 35511 +28
Branches 13014 13024 +10
==========================================
+ Hits 33206 33232 +26
- Misses 1617 1618 +1
- Partials 660 661 +1
🚀 New features to boost your workflow:
|
…igration, executor wiring pending)
A PR currently merges the instant its OWN gate clears, with zero
awareness of an older sibling PR still open in the same repo -- a
live production query proved this causes hundreds of out-of-order
merges per repo (505/708/1364 across the three gated repos), and the
conflicts that follow.
Adds a new settings.mergeTrainMode ("off" | "audit" | "enforce",
default "off") gate: "audit" logs what would be held without holding
anything; "enforce" actually defers a merge behind a still-viable
older sibling, bounded by a 24h staleness cap so one stuck PR can
never wedge the repo's newer ones forever. A git-conflicted sibling
never blocks -- it isn't about to merge, it's stuck.
The decision itself (src/review/merge-train.ts) is a pure function
reusing data already fetched on every merge pass (listOtherOpenPullRequests,
already ordered ascending by PR number) -- no new query, no new
persisted state beyond the one settings column. Wired into
executeAgentMaintenanceActions right before the actual merge mutation,
threaded through the two call sites that can plan a merge action.
0119 was claimed by another merged PR (ai_slop_cache), and 0120 by #4032, while this one was in flight. Renumbered to the next free slot on top of the current branch tip.
fb962f5 to
81cc01e
Compare
Summary
Closes #4004.
A PR currently merges the instant its OWN gate clears, with zero awareness of an older sibling PR still open in the same repo — a live read-only production query proved this causes hundreds of out-of-order merges per repo (505 gittensory / 708 metagraphed / 1364 awesome-claude), and the conflicts that follow.
settings.mergeTrainMode("off" | "audit" | "enforce", default"off") —auditlogs what would be held without holding anything (safe to validate the fix before enabling it for real);enforceactually defers a merge behind a still-viable older sibling.REGATE_REPAIR_ATTEMPT_LOOKBACK_MSprecedent) so one genuinely stuck PR can never wedge the repo's newer ones forever.src/review/merge-train.ts) is a pure, 100%-branch-covered function reusing data already fetched on every merge pass (listOtherOpenPullRequests, already ordered ascending by PR number) — no new query, no new persisted state beyond the one settings column.executeAgentMaintenanceActionsright before the actual merge mutation, threaded through the two call sites that can plan a merge action (the main per-PR maintenance pass, and the approval-queue accept-replay path).RepositorySettingstype, OpenAPI schema, and both.gittensory.yml.example/config/examples/gittensory.full.yml(byte-sync verified via the existingconfig-templates.test.ts).Recommended rollout: enable
mergeTrainMode: auditfirst on each gated repo to observe how often it would fire with zero behavior change, then flip toenforceonce validated.Validation
npm run typecheck— cleannpm run db:migrations:check/db:schema-drift:check/docs:drift-check— cleannpm run ui:openapi:settings-parity— clean (98 fields matched)npx vitest run test/unit/merge-train.test.ts test/unit/agent-action-executor.test.ts test/unit/config-templates.test.ts— 182/182 passing, 100% branch coverage on the new pure moduleNotes
Companion tracking issue #4006 (the P1: event-driven re-gate trigger on sibling merge) is a natural follow-up to close the remaining "stale sibling" gap, but is out of scope for this PR.