fix(bin): strengthen worker cleanup and continuation contracts - #4
Merged
Conversation
V4f1k
force-pushed
the
fm/brief-uklid-zateze
branch
from
August 15, 2026 10:03
af0c33c to
acbc78a
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.
Intent
Strengthen the generated Firstmate worker brief so any worker that creates synthetic load or another long-lived helper process must clean it up in the same turn using recorded process identities, including when the process runs outside the task worktree where ordinary teardown cannot reach it. The motivating incident left task-created CPU burners and shells reparented to PID 1 across scratch space and no-mistakes worktrees, starving the shared no-mistakes daemon; the brief must prevent that without broad process matching, shared-daemon restart instructions, or claiming ordinary worktree teardown owns out-of-worktree processes. Acceptance requires the generated contract to require exact PIDs or comparably exact process identities for synthetic load and long-lived helpers; bounded same-turn cleanup and verification that recorded processes exited, including out-of-worktree helpers; no broad pkill -f, daemon restart, PID guessing, or cleanup of processes the worker did not create; explicit wording that ordinary task teardown is not a fallback for out-of-worktree scratch or pipeline-owned worktrees; and extensions to the smallest existing fm-brief.sh executable-output tests without asserting implementation-source bytes. Keep this PR scoped to ordinary ship and scout worker briefs: the captain declined the persistent secondmate charter expansion, so make no persistent secondmate charter change; the separate queued task secondmate-lifecycle-process-cleanup owns that later investigation. Treat a new teardown scanner or cross-worktree process-attribution subsystem as a separate engineering-contract expansion requiring a decision rather than implementing it here. Validate the complete committed change through the no-mistakes pipeline, including tests, shellcheck, fm-lint.sh, and fm-doc-audience-check.sh where applicable, push fm/brief-uklid-zateze to https://github.com/V4f1k/firstmate.git, open the PR against main, and never merge.
What Changed
resolved:as a Codex Desktop status prefix.Risk Assessment
✅ Low: The change is well-bounded to generated ordinary ship and scout briefs, satisfies the process-identity and cleanup contract without affecting secondmate charters, and tests the executable generated output rather than implementation-source bytes.
Testing
Inspected the committed change, ran the focused fm-brief executable-output tests, generated and reviewed ship/scout/secondmate briefs, captured reviewer-visible evidence, and confirmed the required cleanup contract and intended scope all pass without altering the worktree.
Evidence: Generated ship worker brief
Source: Generated ship worker brief
Evidence: Generated scout worker brief
Source: Generated scout worker brief
Evidence: Unchanged-scope secondmate charter
Source: Unchanged-scope secondmate charter
Evidence: Generated brief scope verification
Source: Generated brief scope verification
Generated briefs contain one cleanup contract for ship, one for scout, and none for secondmate. The contract requires exact recorded identities, bounded same-turn cleanup, exit verification, out-of-worktree coverage, and forbids broad matching, daemon restarts, PID guessing, and non-owned cleanup.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
Inspectedgit diff 2d475fa3ffe21726dc2f6e3b004e381c17b0033d..72a255f2238e93607c2eba51ddf0c21b7bc524b3.Ranbash tests/fm-brief.test.sh.Generated end-user outputs withbin/fm-brief.sh cleanup-ship demo-project --mode no-mistakes,bin/fm-brief.sh cleanup-scout demo-project --scout, andbin/fm-brief.sh cleanup-secondmate --secondmate --no-projects.Verified generated scope with exact section counts: ship=1, scout=1, secondmate=0, and reviewed the emitted cleanup contract.Rangit status --shortafter testing and confirmed no transient worktree changes remained.✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.