Parent: #9499
Summary
Phase 1 of #9499: make the existing oldest-first ordering mechanism actually work, before deciding whether an explicit focus gate (Phase 2) is still needed on top of it.
jobClaimSortKey sorts agent-regate-pr jobs by the PR's own createdAt ascending — genuine oldest-first, and JobMessage.prCreatedAt's own doc says it exists for exactly this. But an omitted prCreatedAt does not merely lose the ordering: jobClaimSortKey falls back to LEGACY_AGENT_REGATE_SORT_BASE_MS + prNumber (≈9.5e11), which sorts ahead of every real 2026 PR (≈1.78e12) — an omission actively inverts the ordering for that producer's jobs.
Five of eight producers had drifted this way.
What was verified, and one correction to the parent issue
Two of the parent's five flagged sites (processors.ts:5032 and :5086) already carry prCreatedAt on current main — confirmed by direct inspection, not by re-reading the issue. Only scheduleTrailingMergeableStateReReview (processors.ts:5080, the trailing mergeable-state re-check) was genuinely missing it.
Also corrected: the parent's side-note that mergeTrainMode might be dead code on HEAD is wrong. Verified end to end (parseFocusManifestContent → resolveEffectiveSettings): a repo .loopover.yml settings.mergeTrainMode: enforce resolves to enforce. The "off" at repositories.ts:914 is only the DB-layer default, same as its sibling config-as-code settings — the parser lives in packages/loopover-engine/src/focus-manifest.ts:3160, outside the src/-scoped grep that produced the doubt. Recorded on the parent issue too, so it is not re-investigated.
Deliverables
Explicitly out of scope for this sub-issue
Tests (must fail against current main)
Expected outcome
Every current agent-regate-pr producer carries prCreatedAt, and CI fails the PR that introduces the next one that doesn't — closing the gap mechanically rather than requiring it to be re-found by a future audit.
Parent: #9499
Summary
Phase 1 of #9499: make the existing oldest-first ordering mechanism actually work, before deciding whether an explicit focus gate (Phase 2) is still needed on top of it.
jobClaimSortKeysortsagent-regate-prjobs by the PR's owncreatedAtascending — genuine oldest-first, andJobMessage.prCreatedAt's own doc says it exists for exactly this. But an omittedprCreatedAtdoes not merely lose the ordering:jobClaimSortKeyfalls back toLEGACY_AGENT_REGATE_SORT_BASE_MS + prNumber(≈9.5e11), which sorts ahead of every real 2026 PR (≈1.78e12) — an omission actively inverts the ordering for that producer's jobs.Five of eight producers had drifted this way.
What was verified, and one correction to the parent issue
Two of the parent's five flagged sites (
processors.ts:5032and:5086) already carryprCreatedAton currentmain— confirmed by direct inspection, not by re-reading the issue. OnlyscheduleTrailingMergeableStateReReview(processors.ts:5080, the trailing mergeable-state re-check) was genuinely missing it.Also corrected: the parent's side-note that
mergeTrainModemight be dead code on HEAD is wrong. Verified end to end (parseFocusManifestContent→resolveEffectiveSettings): a repo.loopover.ymlsettings.mergeTrainMode: enforceresolves toenforce. The"off"atrepositories.ts:914is only the DB-layer default, same as its sibling config-as-code settings — the parser lives inpackages/loopover-engine/src/focus-manifest.ts:3160, outside thesrc/-scoped grep that produced the doubt. Recorded on the parent issue too, so it is not re-investigated.Deliverables
prCreatedAtthroughscheduleTrailingMergeableStateReReview— the one genuine omission.scripts/check-regate-sort-key.ts: everytype: "agent-regate-pr"producer must carryprCreatedAtwithin its own object literal, or be explicitly allowlisted with a reason. A type-level guard cannot express this (prCreatedAtis legitimately optional onJobMessage), so this reads producer sites directly — the same "state the exception, don't infer it from absence" shape ascheck-dead-source-files.ts's entry points.test:ciand CI, alongside the sibling drift checks.Explicitly out of scope for this sub-issue
maybeEnqueueSiblingRegateForMergedPrand theisRegateRepairExhaustedrepo#pr#headSha rekey — both already landed independently (drift: the #9399 sibling-guard pattern is live in four more places — fix the four, then remove the structure that generates them #9491's sibling-drift work and the queue: no 'current focus' concept exists, and oldest-first ordering is defeated by 5 of 8 regate producers omitting prCreatedAt #9499-adjacent repair-budget fix), verified present on currentmain.Tests (must fail against current main)
createdAtand sorts by it, not the legacy base.prCreatedAtmask a neighbouring producer's omission (verified as a real false negative while writing the check).Expected outcome
Every current
agent-regate-prproducer carriesprCreatedAt, and CI fails the PR that introduces the next one that doesn't — closing the gap mechanically rather than requiring it to be re-found by a future audit.