Repository navigation
fix(bin): harden watcher continuity and stale-wake handling - #5
Merged
Merged
Conversation
…nchenguid#693) * fix: make watcher supervision continuous * no-mistakes(review): Bound watcher retries and log attached signals * no-mistakes(review): Add bounded successor-recovery wake fallbacks * no-mistakes(review): Prevent overlapping successor-arm retries * no-mistakes(review): Resume supervision after late arm closes * no-mistakes(review): Bind OpenCode recovery to attempted arm * no-mistakes(test): Synchronize peer beacon regression fixture * no-mistakes(test): Synchronize Pi and OpenCode late-close lifecycle fixtures * no-mistakes(document): Captain: document watcher successor protocol behavior * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes * no-mistakes: apply CI fixes
* fix: always fetch PR head for review diffs Prefer a freshly fetched refs/pull/<n>/head over a reachable recorded pr_head= so reviewers never hold a merge over a "missing" fix that already landed on the remote PR. Recorded SHA is offline fallback only; local branch is last resort with a warning. Store the tip under refs/fm-review/ so a later base-branch fetch cannot clobber the compare tip via FETCH_HEAD. * no-mistakes(test): Isolate session-start nudge tests from gate state * no-mistakes(document): Correct review-diff documentation
…and skills (kunchenguid#736) * docs: resolve five contract contradictions * no-mistakes(test): align owner-pointer assertions with reworded docs; skip absent shellcheck
* docs(harness): reverify grok exit command * no-mistakes(test): Correct Grok exit resume attribution
* fix(watcher): bound stale wakes for exited paused crew * no-mistakes(review): Gate pause suppression on confirmed agent death * no-mistakes(test): Fixed stale pause cadence * no-mistakes(document): Document dead-agent hold cadence
…id#744) * fix(supervision): distinguish ordinary wakes from repair * no-mistakes(review): Make passive guard follow-ups recovery-only * no-mistakes(document): Clarify recovery-only turn-end guard documentation
Merges kunchenguid/firstmate main into the fork, bringing in kunchenguid#743, kunchenguid#693, kunchenguid#744, kunchenguid#736, kunchenguid#722, and other upstream commits since the fork diverged at bc1a21b, while preserving the fork's four features (kimi adapter, watcher stale-suppression fix, flaky-test stabilization, GLM harness_profile axis). Conflict resolution: - bin/fm-watch.sh (pause_state_class and its three call sites): upstream's kunchenguid#743 added agent-liveness detection to bound stale wakes for a parked crew whose agent has confidently exited. The fork's #2 fixed a different case in the same defect class - a stale/misattributed no-mistakes run-step outcome outranking a crew's own later paused: declaration, causing a bare stale wake to refire on every watcher restart. Upstream's structure is the superset (kept), but its early-return treated any non-dead liveness read (both "alive" and "unknown") as license to bypass the pause cadence and re-derive the crew-state read every poll. That regressed the fork's throttling guarantee for an "unknown" liveness read (no live pane to sample), which is exactly the fork's regression scenario. Fixed by narrowing the bypass to a CONFIRMED-alive agent only (a live decision gate that must not be hidden behind the cadence, per upstream's own test_exited_declared_pause_is_bounded_but_live_gate_surfaces); dead and unknown liveness both stay on the bounded/throttled cadence. The fork's first-sight wrapper (trusting the status log's paused: word over a crew-state verdict) was reverted in favor of upstream's plain pause_state_class dispatch, since the agent-liveness signal is a strict improvement over that text heuristic and the wrapper suppressed upstream's required immediate surface for a live decision gate. Both the fork's regression test (test_nonterminal_stale_paused_survives_misattributed_run_step_across_restarts) and upstream's new test (test_exited_declared_pause_is_bounded_but_live_gate_surfaces) are kept and pass. - docs/architecture.md: merged both sides' substance (upstream's dead-agent bounded-cadence description plus the fork's "only positive working evidence displaces pause treatment" sentence) rather than picking one; they describe complementary facets of the same merged behavior. - tests/fm-watch-triage.test.sh: kept both new tests (fork's misattributed run-step regression, upstream's exited-pause/live-gate coverage) and both registrations. - tests/fm-watcher-lock.test.sh: upstream's kunchenguid#693 rewrote the watcher-arm script's restart peer handling (attach-and-follow a healthy peer instead of reporting-without-attaching) - a feature the fork never touched (0-line diff from the merge base). Took upstream's test (test_watch_restart_attaches_to_healthy_peer) wholesale since it now matches the actual upstream-owned implementation; the fork's prior version asserted the opposite (now-obsolete) contract. The fork's TERM-resistant-peer race fix (the ready-file synchronization helper) was shared context in both versions and is unaffected. Also fixed in this branch: tests/fm-kimi-harness.test.sh was missing its executable bit since the fork's kimi-adapter PR first added it (pre-dates this merge, confirmed via git ls-tree at the prior tip) - blocked the full suite; fixed via chmod +x. Sanity-checked: kimi adapter, GLM harness_profile axis, and the flaky-test fixes all verified intact post-merge with no silent regressions from upstream's neighboring-line changes. Full suite: 84/84 test files green, both watcher suites green (35/35 and 26/26), shellcheck clean.
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
Sync the fork with upstream: merge upstream/main (kunchenguid/firstmate) into the fork's main via a genuine merge commit (never rebase), reconciling conflicts between the fork's 4 ahead PRs (kimi crewmate/scout harness adapter, a watcher stale-suppression restart-refire fix, flaky-test stabilization, and a GLM harness_profile dispatch axis) and upstream's advances since divergence (notably kunchenguid#743 bound-stale-wakes-for-parked-crew and kunchenguid#693 continuous-watcher-supervision, both touching the same bin/fm-watch.sh area as the fork's own stale-suppression fix). The critical decision: upstream's kunchenguid#743 added agent-liveness detection (dead/alive/unknown) to bound stale wakes, and its structure is a superset of the fork's fix, but a naive line-based auto-merge combined them incorrectly - it treated 'unknown' agent liveness the same as 'alive' as license to bypass the pause cadence and re-derive crew state every poll, which silently regressed the fork's own regression-test guarantee (a misattributed no-mistakes run-step outcome must not re-trigger a stale wake on every watcher restart). Fixed pause_state_class so only a CONFIRMED-alive agent bypasses the bounded-pause cadence; dead and unknown liveness both stay bounded/throttled - this satisfies upstream's own new test (a live external-decision gate must still surface immediately) while preserving the fork's regression coverage (an unknown-liveness misattributed-run-step case must stay throttled, not re-read crew state or re-surface every restart). Also reverted a fork-side status-log-text wrapper that the merge had left in place at the first-sight branch, since it suppressed upstream's required immediate surface for a live decision gate and is strictly inferior to the new agent-liveness signal. For tests/fm-watcher-lock.test.sh, took upstream's rewritten restart-attaches-to-healthy-peer test wholesale (bin/fm-watch-arm.sh is a file the fork never touched - 0-line diff from the merge base - so upstream fully owns that behavior; the fork's old test asserted the now-obsolete opposite contract). For docs/architecture.md, merged both sides' explanatory prose rather than picking one, since they describe complementary facets of the same merged behavior. Also fixed an unrelated pre-existing fork bug found during full-suite validation: tests/fm-kimi-harness.test.sh was missing its executable bit since the original kimi-adapter PR (confirmed via git ls-tree at the prior branch tip, predates this merge) and was silently failing every CI run of the full suite with a shell permission-denied error - not a real test failure. Verified: all four fork features (kimi adapter, watcher fix, flaky-test stabilization, GLM axis) still functional post-merge with no silent regressions where upstream touched neighboring code (fm-spawn.sh, fm-bootstrap.sh, the harness-adapters skill). Full local suite: 84/84 test files green, both watcher suites green (fm-watch-triage.test.sh 35/35, fm-watcher-lock.test.sh 26/26), shellcheck clean.
What Changed
Risk Assessment
Testing
The supplied full-suite baseline had already passed; targeted watcher, Kimi, Codex-profile, secondmate, bootstrap, and instruction-owner suites passed, while manual CLI evidence confirmed unknown-liveness throttling, immediate live-gate surfacing, and healthy-peer restart attachment. This is shell-only behavior, so the reviewer-visible terminal transcript is the applicable UI evidence.
Evidence: Watcher end-to-end CLI transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
command -v tmux >/dev/null || { echo "tmux is required for e2e tests" >&2; exit 1; }; tmux -V; rc=0; for t in tests/*.test.sh; do echo "== $t =="; bash "$t" || rc=1; done; exit "$rc"Configured full-suite command was reported as a successful baseline (not rerun).bash tests/fm-watch-triage.test.shbash tests/fm-watcher-lock.test.shbash tests/fm-kimi-harness.test.shbash tests/fm-spawn-dispatch-profile.test.shbash tests/fm-secondmate-harness.test.shbash tests/fm-bootstrap.test.shbash tests/fm-instruction-owners.test.shbash /var/folders/md/6d3x0xmj0rd3sxvq647l2jnh0000gn/T/no-mistakes-evidence/01KXYKH1KVB3924F6M7XQXG8SJ/watcher-e2e-evidence.shgit rev-list --parents -n 1 92290c90b4af3aff9136a1da0313fa6e3928c519andgit ls-tree -r --long 92290c90b4af3aff9136a1da0313fa6e3928c519 tests/fm-kimi-harness.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.