fix(rig-control): brightness restore after sleep + stale-restore cancellation (rescued from an un-pushed workbench main) - #364
Open
ZacxDev wants to merge 2 commits into
Open
Conversation
Three bugs causing dark screen after wake: 1. Race: background fade_blackout overwrites restore — kill the fade process (via PID file) before restoring; run fade loops foreground so kill stops everything cleanly; make do_wake() blocking 2. Saved brightness of 0 from stale state file — treat 0 as invalid, default to 60 3. DDC-CI flakiness — retry setvcp 3x with 0.5s backoff, tolerates individual failures in fade loops 4. schedule_restore used raw ddcutil (no retry, no 0-default) — now calls monitor-blackout.sh restore which has both 5. restore() cancels timer twice (before and after fade kill) to catch timers created by a fade completing between cancel and kill
Stale pre-fix timers (raw ddcutil, same unit name) were still firing after restore cancelled the current timer. Fix: - cancel_timer: also kill running service instances, reset failed state - schedule_restore: call cancel_timer before creating new timer - Both changes prevent old timers from racing with new ones
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.
Rescues two commits that existed only on the workbench's local
mainand on no remote ref.Why this PR exists
~/workspace/devrcon the workbench was 2 commits ahead oforigin/main, onmain, with neither commit pushed anywhere. PerCLAUDE.md→ Git discipline,scripts/ship.shconverges withmerge --ff-only, so a diverged host is skipped and left as found — it silently stops receiving every future change while still looking healthy. That state also blocked deploying an unrelated in-flight PR to the very host it targets.This is the documented recovery, first half: preserve and push before moving any pointer. The
git reset --keep origin/mainstep is deliberately not done yet — another session has uncommitted work in that checkout right now.What's here
1cb7fbcfix(rig-control): reliable brightness restore after sleep —scripts/monitor-blackout.sh,scripts/rig-control.sh69363a0fix(rig-control): aggressive timer cancellation prevents stale restores —scripts/monitor-blackout.shBoth authored 2026-08-06.
Review note
These commits have never been gated against the tree they now land in — they were committed directly to a local
mainand bypassed PR review and CI. That is the reason this is a PR rather than a push tomain.Not reviewed as part of this rescue:
claudedocs/handoff-rig-control-brightness.mdis untracked in that working tree and appears to belong to the same effort. It was deliberately left alone rather than swept into this branch, since it is another session's working state. It is unsaved work in theRULES.mdsense and should be committed or PR'd by whoever owns it.🤖 Generated with Claude Code