Skip to content

Report the notify follower as restarting after update - #18

Merged
simoncrypta merged 1 commit into
masterfrom
doctor-follower-restart
Oct 31, 2026
Merged

simoncrypta merged 1 commit into
masterfrom
doctor-follower-restart

Conversation

@simoncrypta

Copy link
Copy Markdown
Owner

Problem

Running bercail doctor right after bercail update printed missing notify follower for up to a minute. Update kills the live follower so the new code runs, and the desk mod starts a new one within 60s; doctor ran in that gap.

Change

  • notify_restart_follower (lib/notify.sh) writes a restarted_at stamp in the notify state dir before killing the follower. It removes the stamp if the kill fails, and notify_run clears it when the new follower starts.
  • doctor_notify (lib/doctor.sh): if bercail-notify isn't live and the stamp is within DOCTOR_NOTIFY_RESTART_WINDOW (90s), it prints restarting notify follower (...) and doesn't count it as a failure. With no stamp, or an invalid, future or expired one, it reports missing as before. Doctor still reads only one file and never waits.
  • Update still restarts the follower exactly as before.

Tests

New cases in tests/notify_test.sh use the fake hc:

  • doctor reports restarting right after update, and missing once the window passes
  • invalid, future and absent stamps don't hide a missing follower
  • failed kills and completed restarts leave no grace period

All tests/*_test.sh pass, except handoff_spawn_test.sh when run from a linked worktree. That one fails on master too and is fixed separately in the notify-repo-coverage PR. ShellCheck shows no new warnings: 18 findings on both master and this branch for the touched files.

bercail update kills the live follower so the desk mod starts the new code. Doctor ran in that gap and reported the follower missing for up to a minute.

notify_restart_follower now stamps a restarted_at file before the kill (cleared if the kill fails, and by the new follower on startup). For 90 seconds after the stamp, doctor reports the follower as restarting instead of missing; after that, or with no, invalid, or future stamp, it is missing as before. Doctor still only reads one file.
@simoncrypta
simoncrypta merged commit f3c8f38 into master Oct 31, 2026
2 checks passed
@simoncrypta
simoncrypta deleted the doctor-follower-restart branch November 1, 2026 00:08
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