Date: 2026-08-28/29 UTC
Branch: r5-pairing-recovery
Fork baseline: main version 48
Scope: Codex V4 bootstrap liveness/security hardening only
Production: NO_GO
Recovered objective and gate
The durable CURRENT requires one real user Codex execution on lane CODEX_REAL_RUNTIME_ACCEPTANCE_V1. R4 already verifies that roundtrip fail-closed. R5 does not change that gate.
The R4 pairing route used the fixed real pairing id codex-v4. Once an unconfirmed issuance exceeded its ten-minute expiry, every subsequent valid pairing request returned PAIRING_EXPIRED. No re-issuance path existed, so a lost/abandoned first attempt could permanently block the only real-runtime gate.
Additional hardening findings:
pairing-code comparison used ordinary string equality even though constantTimeEqual already existed;
confirmation expiry was checked before a later unconditional UPDATE, leaving a narrow time-of-check/time-of-use race.
R5 implementation
Added pairing_state.ts with explicit fail-closed states:
ISSUE_NEW
REDELIVER_ACTIVE
REISSUE_EXPIRED
ALREADY_CONFIRMED
INVALID_EXISTING_SESSION
Pair issue now:
compares the V4 pairing code with constantTimeEqual;
redelivers an active unconfirmed issuance;
atomically reissues an expired unconfirmed session using the same fixed pairing id;
rejects confirmed or malformed state;
detects issue/reissue races;
emits CODEX_PAIRING_REISSUED_AFTER_EXPIRY only after a successful atomic reissue.
Pair confirmation now:
rejects invalid timestamps;
returns retryable PAIRING_EXPIRED at the expiry boundary;
atomically confirms only while expires_at is still in the future;
re-reads after a lost race and returns confirmed-idempotent, expired-retryable, or fail-closed race state.
This branch may be merged into the relay because it repairs the bootstrap path without consuming the bootstrap. Merge does not authorize or simulate the real runtime. After merge, health, synthetic pairing regression, acceptance regression, database absence of codex-v4, and audit-chain validity must be rechecked on main.