fix(runtime): reject hour-24 timestamps instead of rolling them #9697
All Vouch review confidence checks passed
Residual risk 0.33 = Change Risk (0.57) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #9697"
general
weight: 0.35
loopx-agent
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
Goal And Delivered Outcome
parseIsoTimestampacceptedT24:00:00by rewriting the hour to00:00, thenDate.parserolled that text to the next midnight. Scheduler backoff, host-failure retention, and active lease deadlines followed the rolled instant. Pythonparse_timestampand the Todo codec already reject the token.2026-01-01T24:00:00Zwas read as2026-01-02T00:00:00.000Z(1767312000000). A host-update failure with thatfailed_atstayed inside the 24h TTL. A monitor schedule and a backoff current/updated clock did not throw. An active lease with thatexpires_atstayed active at2026-01-01T23:30:00Z. After the change those reads are rejected: scheduler timestamps arenull, illegal clocks throwmust be an ISO timestamp, andleaseIsActivethrowsexpires_at must be a valid timestamp.mainat1bdf851e9447bc7c22ab29d10948a674bf4687c4. This does not close an issue.Defect
T24:00:00,T24:00:00.000Z,T24:00:00+08:00, and a space-separated24:00:00Zare not clock fields in this codec.Date.parseturns them into the next midnight (2026-01-01T24:00:00+08:00became2026-01-01T16:00:00.000Z). The shared reader used that rolled instant for:current_time/updated_at(an illegal clock could count as an elapsed interval)generated_at/explicit_next_due_atfailed_atstayed inside the TTL and could suppress a later host update)leaseIsActive(a lease expiring atT24:00:00Zremained active at 23:30 the same calendar day)Reproduction
On
1bdf851e9447bc7c22ab29d10948a674bf4687c4, before the codec change, with the new assertions present:Result: 39 tests, 34 passed, 5 failed.
Expected null, actual 1767312000000for2026-01-01T24:00:00ZT24:00:00Zfailure was kept instead of[]Missing expected exception: 2026-01-01T24:00:00ZMissing expected exceptionfromleaseIsActiveat2026-01-01T23:30:00ZRoot cause
In
parseIsoTimestamp, hour 24 was rewritten to00:00on the same calendar day so the round-trip check passed. The returnedDatewas then parsed from the original text, andDate.parserolledT24:00:00to the next midnight. Non-zero minutes at hour 24 were already rejected; exact24:00:00was the hole. Feb 31 and leap seconds were already rejected.Fix
Reject hour 24 before the calendar check. Do not rewrite it to
00:00and do not return the rolledDate. This is the same fail-closed rule Python and the Todo microsecond codec already use. Writers that emittoISOString()never produce hour 24, so ordinary persisted deadlines are unchanged.Author Declaration
Implemented against
loopx/control_plane/runtime/time.pystable ISO grammar (reject hour 24; do not carry an end-of-day rollover) and the scheduler contract intests/control_plane_ts/scheduler_state_transition_rules.test.tsthat an illegal calendar must not count as an elapsed backoff interval. No separate RFC revision.| Criterion (spec clause) | Disposition | Symbol / path | Test or command |
| --- | --- | --- | --- |
| Hour 24 is not a valid clock and must not roll to the next midnight | implemented |
parseIsoTimestamp| scheduler timestamp / backoff / monitor schedule tests || An active lease must not stay live on a rolled 24:00 deadline | implemented |
leaseIsActive|task_lease_lifecycle.test.ts|| Blank or missing scheduler
updated_atstill counts as elapsed | implemented |schedulerProgressionIntervalElapsed| existing backoff blank-updated_attest, still passing |parseIsoTimestamp, the scheduler timestamp/backoff callers, andleaseIsActive. ConfirmedDate.parserollover in Node before editing. Did not change hardlink, historical ACK, or noop-recovery code.Scope And Continuation
parseIsoTimestamp, including scheduler state and lease expiry.24:00:00as next midnight now fails closed instead of moving the deadline.Validation
68317b50a5ad559d95a6800cc75d11f3bea3e41a| Check kind | Result | Public-safe evidence / limitation |
| --- | --- | --- |
|
unit|passed| Same three Node test files after the fix, plusmonitor_metadata.test.ts,causal_blocked_wait.test.ts, andcanonical_task_lease_renew.test.ts: 139 passed, 0 failed. ||
regression_parity|passed| The five assertions above failed on the pre-fix tree and passed after rejecting hour 24. ||
static|passed|npm run typecheck:control-planeexited 0. ||
integration|passed|uv run --extra test pytest tests/control_plane/test_monitor_state_owner.py -q: 49 passed.uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main --tier quick: merge gate passed. One advisory maintainability ratchet did not involve these files and did not fail the gate.examples/control_plane/monitor-scheduler-contract-smoke.pypassed. ||
unit|failed|npm run test:control-plane: 6928 tests, 6917 passed, 6 failed, 5 skipped. The 6 failures aretask_lease_hardlinks.test.tsandtask_lease_workspace.test.tsGit-origin/worktree cases (task_repository must be a credential-free Git remote...). The same 6 failures reproduce on unmodifiedmainin this environment and do not touch the timestamp reader. |Residual risk
A hand-written or externally supplied
T24:00:00deadline is now unreadable instead of “next midnight.” In-repo writers do not emit that token. Offset hour 24 (+24:00) was already rejected.Frontend / Visual Evidence
Type of Change
LoopX Area
<!-- CURSOR_AGENT_PR_BODY_END -->
<div><a href="https://cursor.com/agents/bc-0d8be500-20e7-53d6-a032-2a38a62e06d6?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-0d8be500-20e7-53d6-a032-2a38a62e06d6&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div>