Repository navigation
feat: end the processes a crashed daemon left (macOS, hand-started Linux) - #98
Merged
Merged
Conversation
… one left On macOS launchd ends only the daemon's own process group, and a daemon started by hand has nobody to end anything. Each bot and browser group is written down in <home>/run/groups with its arguments; the next daemon of the same data folder kills every group whose leader still runs all of them, before any bot starts. Windows keeps its Job Objects and writes nothing down.
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.
Closes the last gap of slice 3 (spec 14.1). On Windows, a bot's Job Object dies with the daemon. On Linux under systemd, the cgroup does. On macOS, launchd ends only the daemon's own process group, so a bot's browser, and anything
claudestarted, outlived a crashed daemon. A daemon started by hand had the same gap on Linux.How
ProcessJob::track(&command)records each bot and browser group in<home>/run/groups(0600), one JSON line with the group id and the arguments. The runtime and the browser call it right afterassign. On Windows it does nothing.platform::track_groups(<home>/run)runs at daemon start, right after the instance lock and before any bot starts. It kills (SIGKILLto the group) every recorded group whose leader still runs all of its recorded arguments (ps -ww -o command= -p), then starts the list over.mcp.json, session id), so a reused pid that belongs to someone else never matches.Tests
Manual test (macOS)
kill -9the daemon.pgrep -fl "user-data-dir=.*browsers"shows nothing left over.