Restart the supervisor when its own code changes - #21
Merged
Conversation
The unit carries `X-RestartIfChanged = false` so a rebuild never disturbs a healthy supervisor. The cost was never stated: home-manager rewrites the unit file and leaves the old process running, so new supervisor code stays dormant until someone restarts it by hand or reboots. On chise that ran for three days. The supervisor was executing a clawde-service store path that had already been garbage-collected, with a specification file that no longer existed, while every rebuild reported success. The sidecar supersession fix shipped in v0.12.7 was live in the store and dormant in the process that was supposed to run it. An activation now compares the running supervisor's command line against the one this generation deploys and restarts only on a mismatch, so a healthy supervisor is still never disturbed. The deployed command is read from a file rather than passed as an argument, because an argument carrying `clawde-service.py --specification-file` would make the check match itself the way a bridge pgrep does. Agent-Machine: kira Agent-Resume: claude --resume efee1316-8d94-438e-951e-e9c978626531
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
What was wrong
clawde.servicecarriesX-RestartIfChanged = false, so home-manager rewrites the unit file on every rebuild and never restarts the running process. New supervisor code stays dormant until a human restarts it or the machine reboots, and nothing reports that.Live evidence on chise: the supervisor had been running since Aug 22 21:05 across generations 1618 to 1626. Its
clawde-servicestore path and its specification file had both been garbage-collected. Every rebuild in that window reported success. The sidecar supersession fix from v0.12.7 sat in the store, deployed and dormant, in the very process meant to run it.What changed
A home activation runs
clawde-supervisor-refresh, which compares the running supervisor's command line against the one this generation deploys and restarts only on a mismatch. A healthy supervisor already on the current generation is still never disturbed, which is what the flag was protecting.The deployed command is read from a
writeTextfile rather than passed as an argument: an argument carryingclawde-service.py --specification-filewould makepgrep -fmatch the checker itself, the same self-match trap the bridge reconcile pattern documents. The checker also filters its own pid.clawdeServiceRestartCommandon linux now runsdaemon-reloadbeforerestart, so a restart cannot start the unit file the activation just replaced.Verification
unit-tests,formatting,lint,discord-transport-eval,global-runtime-stays-universalmain