Skip to content

fix(cron): honor time zones for expanded ISO dates - #135973

Merged
steipete merged 1 commit into
mainfrom
codex/qa-20260901-cron-iso-timezone
Sep 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-20260901-cron-iso-timezone

Conversation

@steipete

@steipete steipete commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

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 add or cron edit would silently get the wrong time when an ISO timestamp had a signed six-digit year and --tz was provided. For example, --at +002027-01-15T12:00:00 --tz America/New_York stored noon UTC instead of 2027-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

  • 593 maintained tests passed, covering the shared parser, zoned conversion, Cron parsing, CLI add/edit and formatting, schedules, and the ClawHub caller. Seventeen boundary regressions were observed failing before the final calendar refactor.
  • Formatting, core graph validation, core and test type checks, both scoped lint passes, and independent Codex review passed.
  • Normal frozen installs and full builds powered the real CLI/Gateway proof. The same 14 cases ran before and after: four wrong schedules and ten correct controls before; all 14 passed afterward. Proof checked mutation responses, stored-value readbacks and human output. All proof jobs, profiles and the exact remote lease were cleaned up. The native proof returned 0; the hosting workflow was intentionally stopped afterward, so its workflow conclusion is not an exact-head CI claim.

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.

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.
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M maintainer Maintainer-authored PR labels Sep 2, 2026
@steipete
steipete marked this pull request as ready for review September 2, 2026 05:25
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 2, 2026
@clawsweeper

clawsweeper Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 1:34 AM ET / 05:34 UTC.

ClawSweeper review

What this changes

This PR centralizes ISO recognition and calendar conversion so expanded-year one-shot cron dates honor --tz in add/edit commands and retain their year in list/show output.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep 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
Reviewed head: 81e4735d88a8197f75950241bdb5e37b50dfab4b
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative shared-owner repair with substantial boundary coverage and no confirmed review finding.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; the submitted body nonetheless describes a real CLI/Gateway before-and-after exercise of the changed add/edit path.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; the submitted body nonetheless describes a real CLI/Gateway before-and-after exercise of the changed add/edit path.
Evidence reviewed 5 items Current-main bug boundary: The current-main zoned parser recognizes only four-digit years, while the CLI applies a supplied timezone only when that recognizer accepts the input; valid signed six-digit ISO dates therefore bypass timezone conversion.
Introduced owner-boundary repair: The PR moves offsetless recognition, UTC normalization, and calendar validation into the shared ISO owner; the CLI then uses that shared recognizer before calling timezone conversion.
Boundary regression coverage: The changed tests cover signed expanded years, date-only values, explicit offsets, default UTC behavior, Date bounds, BCE/year-zero handling, DST folds/gaps, and add/edit command normalization.
Findings None None.
Security None None.

How this fits together

Cron 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]
Loading

Decision needed

Question Recommendation
Should this maintainer-authored cron parsing refactor be accepted once required checks complete on the current head? Accept after exact-head CI: Approve the focused shared-parser repair if required checks complete green on the reviewed head.

Why: The PR is labeled maintainer and repository state identifies its author as a MEMBER, so automated cleanup must leave the acceptance decision to maintainers.

Before merge

  • Complete next step (P2) - No mechanical repair is indicated; normal maintainer acceptance and exact-head CI are the remaining gates for this protected maintainer PR.
Agent review details

Security

None.

PR surface

Source -22, Tests +88. Total +66 across 10 files.

View PR surface stats
Area Files Added Removed Net
Source 4 107 129 -22
Tests 6 134 46 +88
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 10 241 175 +66

Review metrics

Metric Value Why it matters
Production versus tests production +107/-129 (net -22); tests +134/-46 (net +88) The repair removes duplicate production parsing while adding focused contract coverage for the newly unified boundary.

Technical review

Best 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 parseAt from applying --tz to signed six-digit ISO values, while the fallback parses them as UTC.

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.

Labels

Label changes:

  • add P2: The PR corrects a narrow but user-visible one-shot cron scheduling error for valid expanded ISO inputs.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; the submitted body nonetheless describes a real CLI/Gateway before-and-after exercise of the changed add/edit path.

Label justifications:

  • P2: The PR corrects a narrow but user-visible one-shot cron scheduling error for valid expanded ISO inputs.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Repository state identifies this as a MEMBER-authored PR, so the external-contributor proof gate does not apply; the submitted body nonetheless describes a real CLI/Gateway before-and-after exercise of the changed add/edit path.

Evidence

What I checked:

  • Current-main bug boundary: The current-main zoned parser recognizes only four-digit years, while the CLI applies a supplied timezone only when that recognizer accepts the input; valid signed six-digit ISO dates therefore bypass timezone conversion. (src/infra/format-time/parse-offsetless-zoned-datetime.ts:4, f1169f65b70f)
  • Introduced owner-boundary repair: The PR moves offsetless recognition, UTC normalization, and calendar validation into the shared ISO owner; the CLI then uses that shared recognizer before calling timezone conversion. (src/shared/iso-time.ts:8, 81e4735d88a8)
  • Boundary regression coverage: The changed tests cover signed expanded years, date-only values, explicit offsets, default UTC behavior, Date bounds, BCE/year-zero handling, DST folds/gaps, and add/edit command normalization. (src/infra/format-time/parse-offsetless-zoned-datetime.test.ts:30, 81e4735d88a8)
  • Feature history: History shows the merged cron timestamp repair and earlier zoned-date work in the same area; this PR follows that maintained shared-ISO/cron boundary rather than adding a parallel parser. (src/infra/format-time/parse-offsetless-zoned-datetime.ts:9, 523eec543ee9)
  • Reviewed production/test delta: Production code is net negative after removing duplicate parsers; test growth is targeted at the expanded ISO and calendar-boundary contract. (81e4735d88a8)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer review complete: accepting the shared ISO-owner repair. CI passed on the reviewed head 81e4735d88a8197f75950241bdb5e37b50dfab4b; both independent Codex reviews found no actionable defects.

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.

@steipete
steipete merged commit 5170c24 into main Sep 2, 2026
348 checks passed
@steipete
steipete deleted the codex/qa-20260901-cron-iso-timezone branch September 2, 2026 05:38
@steipete

steipete commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 3, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant