fix(daemon): resume repaints the zone immediately, not eventually - #12
Merged
Conversation
Confirmed live 2026-08-08 03:56 AM: the resume-race fix stopped the daemon from re-suspending itself, but a resume did nothing but clear the SUSPENDED flag and reset classification state -- no write. During the day the next regular tick (up to `interval` later) would drive the curve anyway, papering over it; at night, out-of-window ticks are Hold by design, so a toggle-resume produced no visible change at all (logged "power-cycle -> resumed", mode correctly left "suspended" -> "night_idle" -> nothing). The user's own words: "the whole goal is for it to go back to circadian mode when you do that toggle" -- the toggle being on has to mean circadian visibly owns the zone right now, not whenever the next tick happens to land. Adds _drive_or_rest_locked(): write the current curve sample if in-window, otherwise the resting state (night_look or off), updating _cmd_* on success. _resume_locked() now calls it directly instead of waiting on the next tick. night_guide's own hand-back (previously duplicating this exact recompute inline) now calls the same shared helper instead -- one source of truth for "what should this zone show right now," used by both resume paths. 2 new tests covering the day and night cases, verified to fail on the pre-fix code (call site disabled, ran red, restored) and pass on the fix. Full suite (395 tests) + mypy clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-landing 8f555bc through a proper PR (originally direct-pushed to main,
reverted in #9).
Confirmed live 2026-08-08: the resume-race fix (#10) stopped the daemon from
re-suspending itself, but a resume did nothing but clear the SUSPENDED flag
and reset classification state — no write. During the day the next regular
tick redrove the curve anyway, papering over it; at night, out-of-window
ticks are Hold by design, so a toggle-resume produced no visible change at
all.
Adds
_drive_or_rest_locked(): write the current curve sample if in-window,otherwise the resting state (night_look or off), updating
_cmd_*onsuccess.
_resume_locked()now calls it directly instead of waiting on thenext tick. night_guide's own hand-back (previously duplicating this exact
recompute inline) now calls the same shared helper instead.
2 new tests covering the day and night cases, verified to fail on the
pre-fix code (call site disabled, ran red, restored).