refactor: share owner guardian supervision primitive - #412
Open
codeforester wants to merge 1 commit into
Open
Conversation
codeforester
force-pushed
the
enhancement/395-20260903-background-guardian-process-pattern-duplicated-between-lib-s
branch
3 times, most recently
from
September 3, 2026 19:04
d6fa205 to
1996655
Compare
codeforester
force-pushed
the
enhancement/395-20260903-background-guardian-process-pattern-duplicated-between-lib-s
branch
from
September 3, 2026 19:34
1996655 to
8e2329d
Compare
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.
Summary
Extract the FIFO owner-guardian lifecycle into
lib_std.sh, including readiness signaling, PID-recycling-safe parent checks, stop/wait handling, and cleanup ordering. The GitHub retry-capture guardian now uses the shared primitive through a small cleanup adapter. The timeout supervisor keeps its existing process-group watchdog path, avoiding a second per-command guardian process while retaining the established TERM/KILL timeout contract.Issue
Fixes #395
Validation
git diff --checkshfmt -d -ln bash -i 4 -sr lib/bash/std/lib_std.sh lib/bash/gh/lib_gh.shbats lib/bash/std/tests/lib_std.bats(227/227)bats lib/bash/gh/tests/lib_gh.bats(71/71)tests/artifact-contract.sh(five consecutive runs passed across source, generated, vendored, standalone, and project-kit modes)env -u BASE_HOME BASE_CACHE_DIR=/private/tmp/base-bash-train-395-final-clean ./tests/validate.sh(615 BATS tests and every repository contract passed)Demo Impact
None.
Docs Impact
None; this is an internal supervision refactor with no new public command or option.
API Impact
No public API change. A namespaced internal stdlib primitive now centralizes owner liveness, FIFO control, readiness, and stop semantics for asynchronous helpers.
CI Impact
The GitHub capture guardian suite exercises the shared implementation; the timeout path retains its existing process-group behavior and avoids extra per-command process overhead.
Security Notes
The shared guardian preserves the existing reparenting check and PID-recycling protection, closes inherited FIFO descriptors, and performs cleanup only after removing the control channel. The timeout supervisor continues to isolate and escalate the supervised command group.
Notes
Caller-specific behavior remains in adapters: GitHub removes its capture workspace, while timeout retains the established deadline and process-group escalation path.
Checklist
<category>/<issue>-<YYYYMMDD>-<slug>.Fixes #395.