Skip to content

runner: a shift with no lease to run says so, instead of exiting empty - #20

Merged
JulienMartel merged 1 commit into
mainfrom
worktree-snug-weasel
Sep 9, 2026
Merged

JulienMartel merged 1 commit into
mainfrom
worktree-snug-weasel

Conversation

@JulienMartel

Copy link
Copy Markdown
Contributor

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 really 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.

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, the run loop's lease-ended arm: a run that never passed now prints watchdog: no live lease — nothing to run on fd 1, the wording watchdog check already 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 keeps shift-over in 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 -x clean over bin/, libexec/, lib/, script/.

The launchd side was checked live on this Mac at the same time: kill -9 on the runner, and launchd had a new one up 45 seconds later, with launchctl list showing the real pid and the lease still standing.

🤖 Generated with Claude Code

https://claude.ai/code/session_017uuiiPBXaJL8ozmzYP9KUf

`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
@JulienMartel
JulienMartel merged commit 7e2fac2 into main Sep 9, 2026
2 checks passed
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