Skip to content

fix(automations): show the saved schedule time on DST spring-forward days - #52107

Merged
nwparker merged 1 commit into
stablyai:mainfrom
SeungWoonSong:fix/automation-schedule-label-dst
Nov 29, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
SeungWoonSong:fix/automation-schedule-label-dst

Conversation

@SeungWoonSong

@SeungWoonSong SeungWoonSong commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

If you save an automation for 2:30 AM, Orca now keeps showing "2:30 AM" even on the day the clocks jump forward and skip that hour. Before, it showed "3:30 AM" for that whole day, which made it look like the schedule had been saved wrong.

What Changed

  • Before: on a spring-forward day, a schedule saved as 30 2 * * * in America/New_York was labeled Daily at 3:30 AM. Any saved time inside the skipped hour was shown shifted by the DST offset (for example Europe/Berlin 2:00 showed as 3:00, Lord Howe 2:15 showed as 2:45).
  • After: the label shows the saved time (Daily at 2:30 AM) every day of the year.
  • Mechanism: the shared formatTime in src/shared/automations/scheduling/automation-schedules.ts used to call new Date() and setHours(hour, minute), which rolls a local time in the DST gap forward to the next valid time. It now formats Date.UTC(2000, 0, 1, hour, minute) with a formatter whose timeZone is UTC. UTC has no DST gap, so the hour and minute come back as saved. The device locale and the hour/minute options are unchanged, so 12h/24h display follows the user's locale as before. The formatter is built once and reused instead of once per label.

The desktop renderer's schedule labels, the CLI's orca automations list, and the mobile bot sheet all go through this shared formatter. The scheduler's own occurrence math is untouched.

Why

The label is a display of the saved hour and minute, not of a real instant, so it should not depend on today's DST state. A fixed UTC instant removes that dependency in every zone, including zones whose DST rules change in the future, without needing a hand-picked "safe" local reference date.

Linked Issue

Fixes #52100

Visual Proof

Behavior change is the label text. Captured from the built orca automations list command with the clock frozen at March 8, 2026, 12:00 local time in America/New_York with an en-US locale (from the original PR):

Before

$ orca automations list
demo-automation  DST example  codex  disabled
Daily at 3:30 AM  next: 2026-03-09T06:30:00.000Z

After

$ orca automations list
demo-automation  DST example  codex  disabled
Daily at 2:30 AM  next: 2026-03-09T06:30:00.000Z

Cross-zone probe (saved time inside each zone's gap, formatted on that zone's gap day):

Zone Saved main shows this PR shows
Europe/London 1:30 AM 2:30 AM 1:30 AM
Europe/Berlin 2:00 AM 3:00 AM 2:00 AM
Australia/Lord_Howe 2:15 AM 2:45 AM 2:15 AM
America/Santiago 12:00 AM 1:00 AM 12:00 AM
America/Havana 12:30 AM 1:30 AM 12:30 AM
Pacific/Auckland 2:45 AM 3:45 AM 2:45 AM

On a normal day, every minute of the day formats identically to main across those zones.

Testing

  • Added a regression test in automation-schedules.test.ts that sets TZ=America/New_York, freezes Date on March 8, 2026, asserts local 2:30 AM really rolls to 3:30 AM that day, and checks formatAutomationSchedule('30 2 * * *') returns the saved time. The expected string is built with Intl so the test is independent of the runner's locale. Skipped on Windows like the adjacent DST tests, since Windows Node may ignore runtime TZ changes.

  • On main the new test fails: expected 'Daily at 3:30 AM' to be 'Daily at 2:30 AM'. On this branch: src/shared/automations/scheduling/ 41/41 pass, and the file passes under both TZ=UTC and TZ=America/New_York.

  • macOS (targeted vitest) and Linux (original PR: full test run, CLI build for before/after).

  • oxlint, oxfmt, anti-slop, code-quality native plugins, ast-grep, and the changed-code quality gate are clean on the touched files.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

Performance

Faster. The label formatter is a pure function called once per rendered schedule label; no polling, I/O, subprocess, or cache invalidation is involved, and work per label does not depend on how many automations are mounted. Caching the Intl.DateTimeFormat instead of constructing one per call measured 21.1 us/call on main vs 0.40 us/call on this branch; formatting 200 labels takes 4.22 ms on main vs 0.08 ms here.

Risk

Level: Low

The riskiest part is the displayed hour or hour cycle being wrong. The formatter keeps the device locale and the same options, and a normal-day comparison against main matched for every minute. The cached formatter uses the process default locale, which is fixed for the life of the process, same as before. Plain revert restores the previous behavior; no saved data or settings are touched.

Review

Original fix by @SeungWoonSong in #52107. Maintainer follow-up switched the reference instant to a UTC-zoned formatter and cached it. Authorship is preserved on the squashed commit.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No SSH/remote, agent, persistence, or security paths are touched. Mobile and CLI pick up the fix through the shared formatter.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason (before/after CLI output above)
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@greptile-apps

greptile-apps Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Keeps schedule labels at their saved clock time on spring-forward days.

  • Automation labels keep the saved hour on spring-forward days.

Reviews (2) · Last reviewed commit: "fix(automations): show the saved schedul..." · Reviewed by Greptile

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The schedule formatter now uses a cached UTC formatter and a fixed UTC timestamp. A new test sets the timezone to America/New_York, freezes the clock, and checks the formatted time for a 2:30 AM schedule during the spring-forward transition. The test restores timers and environment variables.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to 666a1

The schedule label should now keep the saved time, such as 2:30 AM, on daylight-saving spring-forward days. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the automation label now shows the saved schedule time on DST spring-forward days. It uses the conventional fix(scope) prefix and matches the production change, which …
Description check Passed The description follows the repository template and covers every required section: ELI5, What Changed, Why, a linked issue (Fixes #52100), Visual Proof with before and after CLI output, Testing with a…
Linked Issues check Passed Issue #52100 requires schedule labels to show the saved daily time (for example, Daily at 2:30 AM for 30 2 * * *) on a spring-forward day, not a shifted time. At the reviewed head, formatTime in…
Out of Scope Changes check Passed The whole-PR diff against the merge base touches only formatTime and the adjacent timeFormat cache in automation-schedules.ts. The cache and the explicit timeZone: 'UTC' option directly serve …
Full details: Title check

Explanation

The title names the main change: the automation label now shows the saved schedule time on DST spring-forward days. It uses the conventional fix(scope) prefix and matches the production change, which anchors the formatter to a fixed reference date. It is specific and clear.

Full details: Description check

Explanation

The description follows the repository template and covers every required section: ELI5, What Changed, Why, a linked issue (Fixes #52100), Visual Proof with before and after CLI output, Testing with a regression test and command output, Performance, Risk with level, AI Disclosure, the upstream boundary checkbox, Notes, and the checklist. The Why section explains the problem and the chosen fixed-date approach, and the Risk section explains how to revert. Two gaps remain: the Why section does not compare the approach with the alternatives it considered, and the Visual Proof is CLI output rather than a UI capture, which the template allows for non-UI output. Neither gap makes the description largely incomplete.

Full details: Linked Issues check

Explanation

Issue #52100 requires schedule labels to show the saved daily time (for example, Daily at 2:30 AM for 30 2 * * *) on a spring-forward day, not a shifted time. At the reviewed head, formatTime in src/shared/automations/scheduling/automation-schedules.ts formats Date.UTC(2000, 0, 1, hour, minute) with timeZone: 'UTC'. UTC has no DST gap, so the saved hour and minute are displayed unchanged. The locale and hour/minute options remain device-driven, so the display still follows the device region. The scheduler is not changed, which matches the issue scope. The whole-PR diff at head differs from the PR description: the description says the fix anchors to a local January 1, 2024 date, but the code uses a UTC instant. The code behavior satisfies the requirement, so the description is stale and not a requirement conflict. The incremental diff from the previous reviewed head could not be read, so the assessment uses the whole-PR diff. The regression test was not inspected directly; this verdict rests on the code diff.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base touches only formatTime and the adjacent timeFormat cache in automation-schedules.ts. The cache and the explicit timeZone: 'UTC' option directly serve the label fix. No scheduler, persistence, SSH, or security code appears in the diff. The CLI and mobile bot sheet pick up the change through the shared formatter. The raw summary and the PR description describe the mechanism differently, but both describe changes limited to label formatting. The test file was not inspected directly, so its scope is supported by the summary only.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9ab3ffd5-3180-46ea-9d8a-86674f75550d
Commits

Reviewing files that changed from the base of the PR and between 223e88e and 666a138.

Files selected for processing: 1

  • src/shared/automations/scheduling/automation-schedules.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

…days

Schedule labels were formatted from today's date with setHours, so on a
spring-forward day a time in the skipped hour (2:30 AM in New York) was
shown an hour later. Format the saved hour and minute as a UTC instant
with a UTC-zoned formatter, which has no DST gap, and cache the formatter
instead of building one per label.

Fixes stablyai#52100

Co-authored-by: Neil <[email protected]>
@nwparker
nwparker force-pushed the fix/automation-schedule-label-dst branch from 223e88e to 666a138 Compare November 29, 2026 00:47
@nwparker
nwparker merged commit 02aba76 into stablyai:main Nov 29, 2026
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Automation schedule labels show the wrong time on spring-forward day

2 participants