fix(codex): respect full weekly reset date in auto-resume wait calc (#1869)#1874
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #1869
Working session summaryThe suite is still running. I'll wait for the background monitor ( This summary was automatically extracted from the AI working session output. |
--tool codex
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $5.849129📊 Context and tokens usage:Claude Opus 4.8: (2 sub-sessions)
Total: (9.0K new + 184.6K cache writes + 6.8M cache reads) input tokens, 50.4K output tokens, $5.849129 cost 🤖 Models used:
📎 Log file uploaded as Gist (3031KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
🔄 Auto-restart 1/5Detected uncommitted changes from previous run. Starting new session to review and commit or discard them. Uncommitted files: Auto-restart will stop after changes are committed or discarded, or after 4 more iterations. Please wait until working session will end and give your feedback. |
…1869 phase 2) The auto-resume path used a separate reset-time parser in solve.validation.lib.mjs that (a) crashed with 'Invalid time format' on year-bearing weekly strings like 'Jun 11, 2026, 12:27 AM' and (b) when it did parse, discarded the date and scheduled for today/tomorrow, so auto-resume woke up far too early on multi-day weekly Codex limits. calculateWaitTime now delegates to the robust date-aware parseResetTime from usage-limit.lib.mjs (honoring explicit year, weekly date, and timezone) and returns the real time-until-reset, consolidating onto a single parser. parseResetTime helper hardened to strip optional ordinal + year. All three call sites forward the timezone. Adds 4 regression tests and a reproduction experiment; documents Phase 2 in the case study with the captured solution-draft log.
Working session summaryDone. All uncommitted changes are resolved and the solution is complete. SummaryThe uncommitted changes were a legitimate Phase 2 fix for issue #1869. I verified, committed, and pushed them; CI is fully green. The bugIssue #1869 had two independent reset-time parsers that drifted apart. PR #1873 (already merged) fixed the display parser. But the auto-resume path used a separate parser in
This is confirmed by the captured real run in The fix
Verification
Working tree is clean; changeset added for the patch release. PR: #1874 This summary was automatically extracted from the AI working session output. |
🔄 Auto-restart 1/5 LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost: $1.095927📊 Context and tokens usage:
Total: (3.2K new + 41.4K cache writes + 1.1M cache reads) input tokens, 10.3K output tokens, $1.095927 cost 🤖 Models used:
📎 Log file uploaded as Gist (3928KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Summary
Fixes #1869 — "Reached limit is incorrect for
--tool codex".The issue had two distinct defects, because hive-mind had two independent reset-time parsers that drifted out of sync. Phase 1 (PR #1873) fixed the display/comment parser. This PR is Phase 2: the auto-resume wait parser in
src/solve.validation.lib.mjs.The Phase 2 bug
When Codex reports a weekly usage limit, the reset string carries an explicit year (e.g.
Jun 11, 2026, 12:27 AM). After Phase 1 the display was correct, but the auto-resume path still:❌ Auto-continue failed: Invalid time format: Jun 11, 2026, 12:27 AM— its localparseResetTimestripped onlyMonth Day,(not the year), so the leftover2026, 12:27 AMfailed the time regex.calculateWaitTimeused only{hour, minute}and scheduled for today/tomorrow, discarding the date. A weekly reset days out collapsed to < 24h.Fix
calculateWaitTimenow delegates to the robust date-awareparseResetTimefromsrc/usage-limit.lib.mjs(the Phase‑1 parser), which honors explicit year, weekly date, time-only, and optional timezone, then returns the realresetDate − now(clamped ≥ 0). Legacy time-only logic is kept only as a fallback. This consolidates onto a single reset-time parser, removing the two-parser drift.parseResetTimehelper is hardened to strip an optional ordinal +Year,so it no longer throws.solve.auto-continue.lib.mjs,solve.auto-merge.lib.mjs,solve.mjs.Reproduction
docs/case-studies/issue-1869/data/solution-draft-log-pr-1781024271855.txtcaptures a real run showing the correct display (in 1d 7h 29m (Jun 11, 12:27 AM UTC)) followed by theInvalid time formatcrash.experiments/issue-1869-codex-weekly-limit-wait.mjsreproduces both defects directly.Tests
tests/test-solve-validation-reset-time.mjsadds 4 Phase‑2 regression tests (year-bearing parse no-throw,calculateWaitTimeno-throw, multi-day-out wait ~3 days, explicit-future-year wait ≥ 365 days). All pass. Related suites remain green:test-usage-limit(78),test-auto-resume-limit-reset(9),test-limit-reset-config(12),test-usage-limit-comment-auto-restart-1570(15),test-auto-restart-usage-limit-1356(26).Invalid time format/ resume in ~16hJun 11, ~31h)Case study
docs/case-studies/issue-1869/README.md§ 9 documents Phase 2 (timeline, root cause, fix, verification). The bug is internal to hive-mind; Codex itself reports correct info, so no external issues were filed.Fixes #1869