Skip to content

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
mainfrom
rescue/rig-control-brightness
Open

fix(rig-control): brightness restore after sleep + stale-restore cancellation (rescued from an un-pushed workbench main)#364
ZacxDev wants to merge 2 commits into
mainfrom
rescue/rig-control-brightness

Conversation

@ZacxDev

@ZacxDev ZacxDev commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Rescues two commits that existed only on the workbench's local main and on no remote ref.

Why this PR exists

~/workspace/devrc on the workbench was 2 commits ahead of origin/main, on main, with neither commit pushed anywhere. Per CLAUDE.mdGit discipline, scripts/ship.sh converges with merge --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/main step is deliberately not done yet — another session has uncommitted work in that checkout right now.

What's here

  • 1cb7fbc fix(rig-control): reliable brightness restore after sleep — scripts/monitor-blackout.sh, scripts/rig-control.sh
  • 69363a0 fix(rig-control): aggressive timer cancellation prevents stale restores — scripts/monitor-blackout.sh

Both 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 main and bypassed PR review and CI. That is the reason this is a PR rather than a push to main.

Not reviewed as part of this rescue: claudedocs/handoff-rig-control-brightness.md is 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 the RULES.md sense and should be committed or PR'd by whoever owns it.

🤖 Generated with Claude Code

ZacxDev added 2 commits August 6, 2026 21:48
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
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