runner: a shift with no lease to run says so, instead of exiting empty - #20
Merged
Merged
Conversation
`factory watchdog run` asked the lease, found none and exited 0 without a word. That was written for a runner someone started by hand, where there was nothing to add. Under launchd it is the ordinary exit: `KeepAlive` starts the runner again every throttle interval for as long as nobody has granted anything, and `launchctl list` showing `- 0` beside an empty `/tmp/haus-factory.out.log` reads exactly the same whether the runner is idle for want of a lease or dying on a bug. It now prints `watchdog: no live lease — nothing to run` on fd 1, the wording `watchdog check` already uses, and still writes nothing to the shift log: nothing passed, so nothing is over. A run that did pass keeps `shift-over` in the log unchanged. The existing case asserted the silence; it now asserts the line, and pins it to fd 1 so the report cannot drift onto stderr. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017uuiiPBXaJL8ozmzYP9KUf
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.
factory watchdog runasked the lease, found none and exited 0 without a word. That was written for a runner someone started by hand, where there really was nothing to add. Under launchd it is the ordinary exit:KeepAlivestarts the runner again every throttle interval for as long as nobody has granted anything, andlaunchctl listshowing- 0beside an empty/tmp/haus-factory.out.logreads exactly the same whether the runner is idle for want of a lease or dying on a bug.Found while proving out haus #688 on this machine. The agent was loaded and correct, the lease had expired, and there was no way to tell that from the outside without reading the source.
What changed
libexec/factory-watchdog, therunloop's lease-ended arm: a run that never passed now printswatchdog: no live lease — nothing to runon fd 1, the wordingwatchdog checkalready uses for the same state. It still writes nothing to the shift log, because nothing passed and so nothing is over. A run that did pass keepsshift-overin the log, unchanged.test/factory-watchdog.bats: the case asserted the silence, and now asserts the line. It also pins the line to fd 1 and stderr to empty, so the report cannot drift onto stderr.README.md: one sentence in the section on what keeps the runner alive, saying why the launchd log of an ungranted machine is a line rather than an empty file.Verified
bats test/242 passing, no failures.shellcheck -xclean overbin/,libexec/,lib/,script/.The launchd side was checked live on this Mac at the same time:
kill -9on the runner, and launchd had a new one up 45 seconds later, withlaunchctl listshowing the real pid and the lease still standing.🤖 Generated with Claude Code
https://claude.ai/code/session_017uuiiPBXaJL8ozmzYP9KUf