Repository navigation
fix: guard Stop hook invocation and secondmate intake and relaunch - #245
Merged
Merged
Conversation
Port of upstream kunchenguid#1853: add record intake for an existing or inherited domain to secondmate-provisioning so a new mate reconciles inherited plans against origin/main and the live deployment instead of inheriting a plan backlog blind.
Port of upstream kunchenguid#6032, adapted to the fork's watcher-arm path (the fork has no supervision host). -h/--help prints usage and any other argument is refused, both before state is read or the watcher armed, so a manual run from a tool turn cannot leave a watcher owned by a short-lived process.
… vanish Port of upstream kunchenguid#4900. The relaunch checkpoint no longer walks state/ with find(1), which can fail when a watcher scratch file vanishes mid-scan; it requires a readable, enterable state/ and keeps the per-*.meta readability loop as the real guarantee. Regression tests live in the fork's tests/fm-secondmate-restart.test.sh, which drives the real fm-control relaunch (the fork has no fm-control-relaunch test file).
Port of upstream kunchenguid#5049. The remote charter copy now rewrites the parent-absolute <FM_HOME>/state/<id>.inbox to the remote home's state/parent-route/<id>.inbox, where the remote control plane records OMP steers, alongside the existing reply-log rewrite. Each rewrite is a plain assignment to avoid the macOS bash 3.2 quoted substitution quote leak. The fork still types non-OMP remote steers, so the upstream test's delivery-count refactors are not carried over; only the charter-render assertions are.
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
Port four small upstream fixes from kunchenguid/firstmate (our upstream) into this fork (dnth/firstmate), adapting each to the fork's current code. The captain asked for "the easy merge" set:
Requirements: for each pick, read the upstream PR diff and discussion, confirm the problem still exists in this fork, then adapt the change by hand to the fork's current structure. Do not cherry-pick blindly and do not pull any other upstream change. If a pick is already fixed in the fork, or adapting it would conflict with a fork-only feature, skip it and record why. Keep each pick in its own commit that names the upstream PR. Credit upstream in the PR body with the four links and state which were ported, adapted, or skipped. Add or adjust tests only where the fork has an existing test for the touched behavior or the upstream PR added one. Shared tracked material follows firstmate-coding-guidelines (one sentence per line in Markdown, plain dash, shellcheck-clean, no agent co-author, tests exercise behavior, never source-string assertions).
Acceptance criteria: AC1 kunchenguid#1853 guard text present in the fork's equivalent doc or a recorded reason it is covered/does not apply. AC2 kunchenguid#6032 Stop hook argument guard ported with a test or reproduction that malformed/missing arguments no longer break the hook. AC3 kunchenguid#4900 wrong relaunch guard removed with a test or reproduction showing the blocked relaunch now proceeds. AC4 kunchenguid#5049 charter inbox path resolves under the second mate's own home, with a test or reproduction. AC5 touched existing test suites pass, and the PR body links all four upstream PRs and states which were ported, adapted or skipped.
Decisions made (deliberate, not mistakes):
What Changed
Risk Assessment
✅ Low: The four ports are narrowly scoped, match the authorized adaptations, and introduce no substantiated correctness, security, or scope issues.
Testing
All three target suites and runtime scenarios passed using real product commands with isolated session/SSH fixtures. Base probes reproduced the fixed failures; an exploratory base lifecycle run encountered an unrelated reconciliation failure. CLI transcripts and generated charter evidence were retained; no rendered UI was changed.
Evidence: Stop-hook argument handling
Evidence: Relaunch output and checkpoint journal
Evidence: Generated remote charter
Evidence: Stop-hook suite
Evidence: Secondmate restart suite
Evidence: Remote lifecycle suite
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.
bash tests/fm-claude-stop-autoarm.test.shin bwrap with workspace-owned /tmpbash tests/fm-secondmate-restart.test.shin bwrap with workspace-owned /tmpbash tests/fm-remote-secondmate-lifecycle-e2e.test.shin bwrap with workspace-owned /tmp; initial recursive fixture setup was stopped and correctedDirect hook invocations with open stdin, nonexistent home/code paths, help flags, unknown arguments, and an empty argumentFocused real-command relaunch and charter drivers with product output capturedFocused regressions against an archived base commit reproduced the pre-fix hook, relaunch, and charter failuresExploratory base remote lifecycle run stopped at an unrelated markerless-reconciliation failureRemoved disposable fixtures and drivers;git status --shortreturned clean✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.