Repository navigation
fix(cron): honor time zones for expanded ISO dates - #135973
Conversation
Use one ISO grammar and Gregorian calendar projection for shared, zoned, and cron parsing. Preserve explicit offsets and UTC defaults while fixing expanded-year CLI add/edit schedules and intermediate Date boundaries. Related: #121394 Production: +107/-129 (net -22); tests: +134/-46. Validated 593 tests, scoped static checks, independent Codex review, and real CLI/Gateway before/after schedules with stored-value readbacks.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 1:34 AM ET / 05:34 UTC. ClawSweeper reviewWhat this changesThis PR centralizes ISO recognition and calendar conversion so expanded-year one-shot cron dates honor Merge readinessKeep open for maintainer review. The introduced shared ISO path fixes the demonstrated expanded-year timezone gap without a concrete correctness or security defect found; this maintainer-labeled, MEMBER-authored PR still requires normal exact-head CI and maintainer acceptance. Priority: P2 Review scores
Verification
How this fits togetherCron CLI commands convert an operator’s one-shot timestamp into a UTC schedule sent to the Gateway. Shared ISO parsing now recognizes and validates that timestamp before timezone conversion, storage, and later CLI display. flowchart LR
A[Cron CLI input] --> B[Shared ISO validation]
B --> C[Timezone conversion]
C --> D[Gateway cron schedule]
D --> E[Stored one-shot job]
E --> F[CLI list and show output]
Decision needed
Why: The PR is labeled Before merge
Agent review detailsSecurityNone. PR surfaceSource -22, Tests +88. Total +66 across 10 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Land the shared ISO-owner refactor after exact-head CI is green, preserving the expanded-year, offset, DST, and Date-boundary regression coverage. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main’s four-digit-only zoned recognizer prevents Is this the best way to solve the issue? Yes. Consolidating recognition and calendar arithmetic in the existing shared ISO owner removes the divergent CLI/cron/zoned-parser rules rather than adding another expanded-year exception. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f1169f65b70f. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer review complete: accepting the shared ISO-owner repair. CI passed on the reviewed head ClawSweeper reported no correctness or security findings. Its remaining steps were maintainer acceptance and exact-head CI, now satisfied. The committed diff is unchanged from the 593-test and real CLI/Gateway proof, with production net −22 and tests net +88. The extreme-date live-admission limitation and recurring-calendar follow-up remain documented in the PR body. |
|
Merged via squash.
|
Use one ISO grammar and Gregorian calendar projection for shared, zoned, and cron parsing. Preserve explicit offsets and UTC defaults while fixing expanded-year CLI add/edit schedules and intermediate Date boundaries. Related: openclaw#121394 Production: +107/-129 (net -22); tests: +134/-46. Validated 593 tests, scoped static checks, independent Codex review, and real CLI/Gateway before/after schedules with stored-value readbacks.
Related: #121394
Additional instructions
This PR uses a branch in
openclaw/openclaw; maintainers with write access can update it.What Problem This Solves
Fixes an issue where users scheduling one-time jobs with
cron addorcron editwould silently get the wrong time when an ISO timestamp had a signed six-digit year and--tzwas provided. For example,--at +002027-01-15T12:00:00 --tz America/New_Yorkstored noon UTC instead of2027-01-15T17:00:00.000Z. Date-only inputs had the same problem.Why This Change Was Made
The shared ISO parser accepted expanded years, but the zoned parser and CLI recognizer independently assumed four digits. This consolidates recognition, UTC normalization and calendar arithmetic in the shared owner. A single 400-year Gregorian projection validates the authored calendar without prematurely clipping intermediate wall times at JavaScript Date boundaries. It removes duplicate parsing and reconstruction instead of adding another special-case parser.
Provenance: related #121394 widened the shared ISO path; the zoned recognizer remained separate. This does not attribute every calendar-boundary defect to that change. Recurring scheduling is unchanged; its separate calendar/day-key limitations remain follow-up work.
Production: +107/−129, net −22. Tests: +134/−46, net +88. No configuration, storage or protocol changes.
User Impact
Expanded-year timestamps now honor the selected time zone consistently in both add and edit. Explicit offsets, the default UTC path, milliseconds, BCE/year 0–99, valid
24:00, and existing DST fold/gap rules retain their contracts. Invalid calendar dates remain rejected, while valid offset-adjusted instants at Date boundaries are accepted.Evidence
Two earlier setup attempts produced no operator evidence: a task-clone repository URL was corrected, then the fresh profile's documented Dreaming setting was disabled before startup to avoid unrelated enabled work. No proof oracle, authentication path, Cron setting or timeout was weakened. The unchanged Gateway scheduling window excludes live DateMin/DateMax/BCE job creation; maintained-owner regressions cover those boundaries.
Reviewed head:
81e4735d88a8197f75950241bdb5e37b50dfab4b. Its committed ten-file diff matches the tested and reviewed patch byte-for-byte. Landing remains gated on this head’s required CI and the native maintainer workflow.