fix: route second-mate wakes by new status span - #5867
Closed
kunchenguid wants to merge 11 commits into
Closed
kunchenguid wants to merge 11 commits into
kunchenguid wants to merge 11 commits into
Conversation
Owner
Author
|
Superseded by #5879, which re-landed this new-span wake-scope fix from a clean branch and has now merged. Closing this one. |
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
Fix the supervision wake scope so a second mate's routine status updates are no longer pinned to main by an unrelated open decision in the same status file.
Evidence from the main home since the attended supervision host landed (PR #5748): of about 60 actionable wakes the host handled 1; 58 were pass-through "attended main-only" (41 mini-default.status, 13 fmdev-f1.status signals), errors=0. Cause: .pi/extensions/lib/fm-branch-dispatch.ts scopeForUnreadWake treats a signal row as decision-owned when hasOpenNeedsDecision over the WHOLE status file is true. For a crewmate one status file is one task, so that is sound; for a second mate the status file is a shared channel carrying many independently keyed decisions, so any one parked captain hold (for example deferred holds) pins every later routine update from that mate to main. The same rule applies on Pi.
Approved design: judge the NEW span of each signal row, not the whole file. Send the wake to main when any new line in the span (a) is a decision (needs-decision or captain-held) or resolves one, or (b) carries the same key as a still-open decision in that file. A key-less new line falls back to its verb: a decision or blocked goes to main, otherwise routine. A wake whose span mixes routine and decision lines goes wholly to main (no row splitting). All-routine spans go to the branch. Keep single-task crewmate status files behaving as today unless the same new-span rule is strictly equivalent for them. Add behavioral tests including a second-mate file with an unrelated open hold plus a routine merged line (branch-eligible), a mixed span (main), a same-key update (main), and a key-less blocked line (main).
Also noted, lower priority: the first attended drain after the switch replayed old branch outcomes as new (already-merged PRs reported open); check whether that one-time backlog needs a cutover guard.
Ship through no-mistakes; the captain merges.
i want to wait for that fix, then live validate the second mate path as well. is that doable?
Context: that means holding the /quiet PR #5779 until this fix lands, and live-validating this fix on the second-mate path before it is called done: a lab primary with the attended supervision host on and a real seeded local second mate under it (lab homes, never live homes). The second mate carries an unrelated open captain hold and then reports routine outcomes (the branch should take them), a mixed batch, a same-key update, and a new decision (main should get them), with the host log lines and main pane evidence shown per scenario. Run it on Claude, and on Pi if the fix touches the Pi branch path.
What Changed
Risk Assessment
Testing
Targeted branch tests passed, and the real dispatch CLI produced the expected routing verdicts recorded in the evidence transcript. Teardown and second-mate safety scripts timed out. The Claude lab primary could not start because the required private tmux socket path exceeded the Unix socket length limit under this worktree; consequently neither the Claude host nor Pi primary was validated with a seeded live second mate.
Evidence: Second-mate dispatch CLI verdicts
Source: Second-mate dispatch CLI verdicts
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ No issues found.
bash tests/fm-pi-branch-extension.test.sh— passedbash tests/fm-branch-supervision.test.sh— passedbash tests/fm-teardown.test.shandbash tests/fm-secondmate-safety.test.sh— timed outDrovenode bin/fm-branch-dispatch.mjs offeragainst an isolated lab home for routine, mixed, timestamped same-key, new-decision, key-less blocked, prose-key, and stale wakesAttempted to launch a Claude primary on the lab-private tmux socket⏭️ **Document** - skipped
Step was skipped.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.