feat(primer): hold off-slot Codex turns so the fixed-slot primer anchors the reset

The usage primer fires at 08/13/18/23 KST but could not pin the Codex 5h
reset because reviewer/arbiter turns on the same shared account ran off-slot
and anchored the window first. Add a time-based hold
(shouldHoldCodexForPrimerAlignment) that keeps non-primer Codex turns quiet
during the 04-08 KST dawn gap and for a few minutes after each slot, so the
scheduled primer wins the first-request race. Applied at the reviewer/arbiter
dispatch site (the actual off-slot consumer here) and for codex-owner rooms;
urgent @-mention turns bypass it. Time-based by design — the usage/reset
figures are exactly the unreliable data, so a blunt clock rule is predictable
and testable.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-06-09 14:31:01 +09:00
parent efc8c00380
commit e324a1baa1
5 changed files with 175 additions and 11 deletions

View File

@@ -352,6 +352,7 @@ async function handleNoMissedMessages(
roleToChannel: runtime.roleToChannel,
labelPairedSenders: args.labelPairedSenders,
mode: 'idle',
triggerPattern: args.triggerPattern,
});
if (pendingTurnOutcome !== null) {
return pendingTurnOutcome;
@@ -393,6 +394,7 @@ function runBotOnlyPendingTurn(
labelPairedSenders: args.labelPairedSenders,
mode: 'bot-only',
missedMessages,
triggerPattern: args.triggerPattern,
});
}