Repository navigation
Catch the bar clock up when the system clock jumps - #13541
stevederico wants to merge 7 commits into
Conversation
Automated AI review
Outcome: While the machine is awake, the new poll can put the label back to the previous minute for about 5 seconds. The poll can undo SystemClock's minute tickSystemClock's minute timer fires on a whole second of the monotonic clock, which is offset from wall-clock seconds, and it snaps to the minute when within 500 ms, so the label often turns up to half a second before the wall clock does. Suggested change: Treat a label less than 1 s ahead of Reproducer (fails at 4309fba)Reproducer: the catch-up poll can put the label back a minuteReviewed head: 4309fba 1. Test case in the PR's styleAdded to // SystemClock's minute tick is a QTimer of 20 s or more, which Qt runs as a
// whole-second timer, and SystemClock snaps to the minute when the tick lands
// within 500 ms of it. So the label can turn up to half a second before the
// wall clock does. A poll in that gap must not roll it back.
assert(!calendar.clockMinuteIsStale(new Date(2026, 8, 27, 14, 6, 0), new Date(2026, 8, 27, 14, 5, 59, 700)), 'clock leaves a label SystemClock published just before the minute turned')Actual output at the reviewed head ( With 2. Real Qt runSetup: Qt 6.11.2, a headless The same sequence repeated at the next minute (−445 / −349 / +4652). The label A poll that fires in the same millisecond as SystemClock's tick, just after it Controls from the same run:
Sweep: at a 250 ms phase, 1 of 20 poll timings (250 ms steps across the 5 s More findingsThe new tests pass with a broken helper or a disabled TimerA helper comparing only Suggested change: Add a same-minute, earlier-hour case and run the wiring regex against Reproducer (mutants pass at 4309fba)Reproducer: the new tests pass with a broken helper or a disabled TimerReviewed head: 4309fba. Each mutant is a Mutant 1: the helper compares only the minute of the hour
function clockMinuteIsStale(shown, now) {
return shown.getMinutes() !== now.getMinutes()
}Result: This assertion catches it (it passes at the head): assert(calendar.clockMinuteIsStale(new Date(2026, 8, 27, 14, 5, 0), new Date(2026, 8, 27, 15, 5, 30)), 'clock sees a label from the same minute of an earlier hour as stale')On the mutant: Mutant 2: the whole catch-up Timer commented outIn Result: the PR's test still prints The same regex run against assert(/Timer \{[^}]*running: !root\.showsSeconds[^}]*clockMinuteIsStale\(root\.displayDate, new Date\(\)\)\) root\.refresh\(\)/.test(widgetSource), 'clock checks for a stale minute in live (uncommented) code')On the mutant: Controls
DetailsVerified
Optional notes
Related open PRs: #12277, #13347 and #10138 fix the same problem in other ways and conflict with this PR in Review informationTest scope: Source code, sandboxed node tests and a headless Qt harness running Quickshell's SystemClock, at AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check. Opt out: To stop receiving these reviews, reply to this comment saying so. |
|
Reviewed at 06501d1 by Claude Opus 5.5, with Codex at medium effort as a second opinion. Five other open pull requests fix the same bug as this one (#13504) in different ways: #12277, #13347, #10138, #9509 and #13658. Codex was asked which of the six is best without being given my answer. It ranked #13347 first and #12277 third, ahead of this one. I agree that this one should not be the fix that goes forward, though Codex may have read my reasoning, so its agreement is not a fully independent check. What I found, checked against the source:
I ran nothing on a worker. That would only spend a worker proving a fix that is not the one going forward. Codex ran the clock tests in its read-only checkout, and they passed. This now waits on the maintainer to choose between the competing fixes. #12277 is already labelled |
[Medium impact] The PR appears safe to merge; only the earlier non-blocking Markdown formatting finding remains. Findings
SummaryAdds a user timer that asks the bar clock to catch up after suspend, clock jumps, or timezone changes.
Reviews (8) · Last reviewed commit: "Catch WallClock up on resync instead of ..." · Reviewed by Greptile |
|
Looked at again at The two findings from the last review are fixed. I checked both against the source. Competing fixes. This one still does not go forward. That is not because of a defect in it. An older fix now does the same thing: #10138 (opened September 4) also restarts both clocks from the current time, catches every resume without depending on unlock, and keeps a browsed month. It does this with a one-second wall-clock check. The rule for competing fixes is that the oldest wins unless a newer one is clearly better. This one adds two things: it also catches wall-clock steps shorter than #10138's three-second threshold, and it adds no new singleton. Neither is a case where #10138 leaves the bug unfixed. I asked Codex to compare all seven open fixes for #13504 without giving it my answer, and it reached the same conclusion for the same reason. It may have read my reasoning, so its agreement is not a fully independent check. I did not run this branch on a worker, because that would spend a worker proving a fix that is not the one going forward. Codex ran Next. This waits on the maintainer to choose among the competing fixes for #13504. #12277 already carries |
c6de2c0 to
819855c
Compare
819855c to
8b686fb
Compare
|
Looked at this again at Two models classified it separately: Claude Opus 5.5 read it as One thing stands regardless of the classification: #10138, #12277, #13347, #9509 and #13658 are still open and fix the same bug in other ways, so which one goes forward remains the maintainer's choice. The comparison among them was not re-run at this head, since an unsettled classification stops the review here. This waits on the maintainer to decide what it is. |
8b686fb to
500c04f
Compare
| `omarchy-crash-watch.service`, `omarchy-clock-resync.timer`) so they run in the | ||
| first session too. |
There was a problem hiding this comment.
The added text in file-layout.md splits a sentence across lines. The Markdown style instruction requires full lines, with breaks only at structural boundaries. Join the changed sentence before merging to meet that requirement.
| `omarchy-crash-watch.service`, `omarchy-clock-resync.timer`) so they run in the | |
| first session too. | |
| `omarchy-crash-watch.service`, `omarchy-clock-resync.timer`) so they run in the first session too. |
File Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
500c04f to
d2b447e
Compare
|
Looked at this again at The approach holds up from the source. Codex read the units, the migration, the first-run change and the QML resync and found no correctness problem. It also checked the mechanism against the kernel and systemd sources: Which fix goes forward is still the maintainer's call, and this time the two models disagree. Six fixes for this bug are open: #9509, #10138, #12277, #13347, this one and #13804. The rule here is that the oldest wins unless a newer one fixes a case the older one misses. I asked Codex to rank all six without giving it my answer.
#12277 already carries This waits on the maintainer to choose among the open fixes for #7608. |
SystemClock waits out the rest of the minute on a timer that stops while the machine sleeps, so after a wake the label and the calendar's today kept the time from before it for up to a minute (omacom#13504). Add an omarchy.clock resync IPC method that re-enables the label's SystemClock and the calendar's. A re-enabled SystemClock re-reads the time and schedules its next tick from now, and onDateChanged puts the result on screen. The calendar restarts its own clock rather than going through refresh(), so a month the user is browsing stays put.
A user timer with OnClockChange=yes and OnTimezoneChange=yes starts a oneshot that runs omarchy-shell -q omarchy.clock resync. systemd waits on a TFD_TIMER_CANCEL_ON_SET timerfd for it, so nothing resident and nothing polling. The kernel cancels that timerfd when CLOCK_REALTIME jumps against CLOCK_MONOTONIC, which a resume from suspend does as well as an NTP step or timedatectl set-time, so one timer covers all of them. New installs enable the timer with the other user units, and a migration enables it for existing ones. Both link the units from default/ into ~/.config/systemd/user, so they follow the shipped files. Fixes omacom#13504
d2b447e to
8e70643
Compare
|
Read the updated diff, clock implementation, tests, existing reviews and linked reports at The source also confirms the two API mismatches Greptile reported: No worker tests ran, and nothing was pushed or marked verified. This waits for classification to be settled; the choice among the competing clock fixes also remains with the maintainer. |
|
@omarchybot The second classifier (deepseek-v4p1-flash) returned no class, and your own call is bug. Please classify again. After a suspend the bar clock keeps showing the pre-sleep time for up to a minute (#13504), so the clock is wrong right when you open the lid. Classification: bug. |
|
Read the updated commit at GPT-6 in Codex (effort setting unavailable) again classifies this as a bug fix. The configured second classifier, |
|
Classification is now agreed as The merged version enables the timer at first run and replaces this PR’s user-level unit links with packaged units and migration GPT-6 in Codex (effort setting unavailable) checked the source comparison. Opus 5.5 High and muse-wonder via pi, thinking high reviewed it and agreed that no code change remains here; independence from the first review is not guaranteed. No worker or runtime tests ran in this pass, and nothing was pushed or marked verified. Thank you, @stevederico, for the fix carried into #20255. This remains open for the maintainer to close or retain. |
Fixes #13504
After a suspend, the bar clock keeps showing the time from before it for up to a minute. Quickshell's
SystemClockwaits out the rest of the minute on a timer that stops during sleep.This adds a user timer,
omarchy-clock-resync.timer, withOnClockChange=yesandOnTimezoneChange=yes. systemd waits on aTFD_TIMER_CANCEL_ON_SETtimerfd for it, and the kernel cancels that timerfd wheneverCLOCK_REALTIMEjumps againstCLOCK_MONOTONIC:timekeeping_resume()callstimerfd_resume(), which callstimerfd_clock_was_set(). So one timer covers a resume, an NTP step,timedatectl set-timeand a timezone change, with no resident process and no polling. It runsomarchy-shell -q omarchy.clock resync, which re-enables the label'sSystemClockand the calendar's. The calendar restarts its own clock instead of callingrefresh(), so a month you are browsing stays put.New installs enable the timer with the other user units, and a migration enables it for existing ones. Both link the two unit files from
default/systemd/user/into~/.config/systemd/user(omarchy-audio-tuningalso puts its unit there fromdefault/), so the links follow the shipped files and never go stale.Tested:
clock-resync-test.sh,clock-test.shand the bar widget contract fixture fail on quattro and pass here.systemd-analyze --user verifypasses, and the timer goesactive (waiting)with no countdown. With a shim that moves only the wall clock, the real widget caught up about 0.1s after the resync call. I did not set the system clock or suspend a real machine.Related: #12277 refreshes on logind's
PrepareForSleep(false)through a residentdbus-monitor; it misses clock steps and timezone changes, and itsrefresh()sends a browsed month back to today. #10138 checks the wall clock once a second from a new singleton (about one wakeup per second while idle); this adds no timer and reacts to the event itself.