Skip to content

fix(daemon): resume repaints the zone immediately, not eventually - #12

Merged
cnewkirk merged 1 commit into
mainfrom
fix/resume-repaints-rest-target-v2
Aug 8, 2026
Merged

fix(daemon): resume repaints the zone immediately, not eventually#12
cnewkirk merged 1 commit into
mainfrom
fix/resume-repaints-rest-target-v2

Conversation

@cnewkirk

@cnewkirk cnewkirk commented Aug 8, 2026

Copy link
Copy Markdown
Owner

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_* 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.

2 new tests covering the day and night cases, verified to fail on the
pre-fix code (call site disabled, ran red, restored).

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>
@cnewkirk
cnewkirk merged commit 15103a8 into main Aug 8, 2026
1 check passed
@cnewkirk
cnewkirk deleted the fix/resume-repaints-rest-target-v2 branch August 8, 2026 12:47
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.

1 participant