feat(spawn): boot-process presence sentinel independent of the ready sentinel#468
Closed
Masashi-Ono0611 wants to merge 1 commit into
Closed
feat(spawn): boot-process presence sentinel independent of the ready sentinel#468Masashi-Ono0611 wants to merge 1 commit into
Masashi-Ono0611 wants to merge 1 commit into
Conversation
…sentinel (#1) The boot script spawn.sh generates now writes its own pid to run/boot-pid.<team>__<agent> right before exec'ing the role's CLI, and clears it right after -- on normal return, and via a trap on HUP/TERM/INT for abrupt termination (SIGKILL still leaves it for the next kill(pid,0) liveness check to invalidate, same contract as every other sentinel in this codebase). This is a liveness signal independent of the existing ready.<team>__<agent> sentinel, which only appears once the CLI/model reaches its own watcher-registration step. Some agent types (grok-build) start their watcher only when the model follows the actas template's instructions (ADR 0003); when the very first model turn itself fails -- e.g. an unresolved rate/usage-limit dialog the CLI presents instead of continuing -- that step is never reached, and an external liveness check has no way to tell "launched and still running, registration incomplete" apart from "nothing was ever launched, or it already exited." Reviewed with Codex (self multi-model review, bounded codex exec) -- 1 Warning addressed (HUP/TERM/INT trap), 2 Suggestions reviewed and left as consistent with existing repo conventions. 65/65 spawn tests pass plus a new test for the sentinel; no regressions in resurrect-panes/actas-lock suites. CI green on ubuntu/macos/windows.
Author
|
Duplicate of #456, which you already opened on 2026-07-20 for the same issue (#455) with additional history (a Codex-review-driven follow-up commit for HUP/TERM/INT trap cleanup that this PR's single squashed commit also includes, just without that separate commit trail). Closing this one in favor of #456 -- apologies for the duplicate, I should have checked for an existing open PR before opening a new one from the same fork branch, not just checked for an existing issue. |
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.
Fixes #455
Summary
The boot script
spawn.shgenerates now writes its own pid torun/boot-pid.<team>__<agent>right before exec'ing the role's CLI, and clears it right after -- on normal return, and via a trap on HUP/TERM/INT for abrupt termination (SIGKILL still leaves it for the nextkill(pid,0)liveness check to invalidate, same contract as every other sentinel in this codebase).This is a liveness signal independent of the existing
ready.<team>__<agent>sentinel, which only appears once the CLI/model reaches its own watcher-registration step. Some agent types (grok-build) start their watcher only when the model follows the actas template's instructions (ADR 0003); when the very first model turn itself fails -- e.g. an unresolved rate/usage-limit dialog the CLI presents instead of continuing -- that step is never reached, and an external liveness check has no way to tell "launched and still running, registration incomplete" apart from "nothing was ever launched, or it already exited."Scoped to
spawn.sh's boot-script launch path only, per #455's discussion;resurrect-panes.sh's tmux-send-keys relaunch (after a server restart) has no boot-script process of its own to carry a pid file, so it's out of scope for this particular fix.Test plan
codex exec) -- 1 Warning addressed (HUP/TERM/INT trap), 2 Suggestions reviewed and left as consistent with existing repo conventions.tests/test_spawn.batspass, plus a new test covering the sentinel.resurrect-panes.bats/actas-lock.bats.grok-buildpeer) uses this sentinel today to distinguish "already booting, don't spawn a duplicate window" from "genuinely dead, recover" -- directly motivated by hitting exactly the scenario in grok-build: liveness check has no way to tell 'CLI alive but stuck before watcher registration' from 'dead' #455 (Grok Build CLI stuck at a weekly-usage-limit dialog before its watcher ever registers).