Repository navigation
fix(pi): route needs-decision signals directly to main - #3680
Closed
kunchenguid wants to merge 19 commits into
Closed
kunchenguid wants to merge 19 commits into
kunchenguid wants to merge 19 commits into
Conversation
Confidence Score: 5/5The PR appears safe to merge based on the established current behavior. No blocking failure remains. Reviews (32): Last reviewed commit: "no-mistakes(ci): Fixed the CI failure by..." | Re-trigger Greptile |
kunchenguid
force-pushed
the
fm/fm-needs-decision-main-only-r1
branch
from
September 4, 2026 04:55
779435c to
3128e41
Compare
kunchenguid
force-pushed
the
fm/fm-needs-decision-main-only-r1
branch
from
September 4, 2026 07:48
2f75036 to
cf96007
Compare
kunchenguid
force-pushed
the
fm/fm-needs-decision-main-only-r1
branch
2 times, most recently
from
September 4, 2026 08:55
31ced07 to
46f0386
Compare
kunchenguid
force-pushed
the
fm/fm-needs-decision-main-only-r1
branch
3 times, most recently
from
September 4, 2026 11:16
4fc3972 to
f5acdb9
Compare
kunchenguid
force-pushed
the
fm/fm-needs-decision-main-only-r1
branch
from
September 4, 2026 11:55
678a929 to
4fc3972
Compare
kunchenguid
force-pushed
the
fm/fm-needs-decision-main-only-r1
branch
from
September 4, 2026 12:29
4fc3972 to
b8493bd
Compare
Comment on lines
+1230
to
+1232
| if (scope.needsDecisionKeys.length > 0) { | ||
| throw new Error("a needs-decision row requires main to drain the complete wake queue"); | ||
| } |
There was a problem hiding this comment.
Mixed queue vetoes supervision
When a routine signal or stale wake is accepted while an unrelated needs-decision row is unread, this whole-queue check rejects the accepted branch delivery, causing the routine row to fall back to the main session instead of remaining branch-eligible.
Suggested change
| if (scope.needsDecisionKeys.length > 0) { | |
| throw new Error("a needs-decision row requires main to drain the complete wake queue"); | |
| } |
Knowledge Base Used: Watch and wake workflows
kunchenguid
force-pushed
the
fm/fm-needs-decision-main-only-r1
branch
from
September 4, 2026 12:56
e7645b6 to
4fc3972
Compare
A needs-decision status append is a captain call - a product decision, a destructive-action confirmation, a captain-hold, a secondmate escalation - and must reach main directly, the same way a check-kind wake already does, instead of taking the supervision-branch hop first. The watcher now marks a needs-decision row's queued payload "needs-decision:" instead of the ordinary "signal:" (including when the classifier wraps a rejected-key transition in its "reconciliation-required: " prefix). The wake message text itself never changes, so every other harness-arm script keeps seeing the same "signal:<files>" shape. The branch dispatcher excludes that payload-marked row from what the branch may claim (reporting it via a new needsDecisionKeys field) without vetoing an unrelated eligible row sharing the queue, and the watch extension cross-references the current trigger's own file list against those keys to force that delivery to main, exactly like a check-kind trigger.
The needs-decision detector previously re-split the joined multi-event display text on literal " ; " and reparsed each chunk, which misreads a routine status note that happens to contain that exact text (for example "done: migration complete ; needs-decision: documented in follow-up") as a real needs-decision event. The classifier now sets its needs-decision flag per line while walking the actual status file, before the events are joined for display, and returns it through an explicit output parameter instead of being reparsed from the lossy joined text. Scope stays limited to the signal path: this does not change how stale, heartbeat, captain-held, push-transition, or any other wake kind is routed.
…rtial branch grants, leaving the complete queue claimable by the already-woken main turn. Added a behavioral regression and updated documentation. Resolved ShellCheck SC2031 lint failures with targeted suppressions. Verified CI-mode lint, focused regression, Pi watcher tests, watch triage tests, and Pi type checks. The full branch-extension suite encountered an unrelated stock-rendering assertion failure
kunchenguid
force-pushed
the
fm/fm-needs-decision-main-only-r1
branch
from
September 4, 2026 13:30
4fc3972 to
1b341e4
Compare
…ted routine rows remain branch-eligible while decision rows stay main-owned. Updated docs and added a behavioral regression proving the branch prompts, grants only routine rows, and rejects undelivered settlement for watcher fallback. Targeted regression, strict Pi typecheck, bash syntax, and diff checks pass. The full extension suite remains blocked by a pre-existing stock-rendering fixture mismatch. The no-mistakes attestation failure is external: its test phase was marked skipped and requires the outer pipeline to rerun it
…s now remain branch-eligible when coalesced with needs-decision files, while all-needs-decision signal closes still route to main. Added an end-to-end watcher regression and updated documentation. Verified the full Pi watcher-extension suite, strict Pi typecheck, ShellCheck, bash syntax, and git diff checks. The no-mistakes attestation failure is external pipeline state (`test` was skipped), not a code defect
kunchenguid
force-pushed
the
fm/fm-needs-decision-main-only-r1
branch
from
September 4, 2026 14:58
2d284a1 to
2a14ac7
Compare
…ows remain branch-eligible, while excluded decision rows wake main after branch settlement, including same-key mixed rows. Updated protocol docs and regression coverage. Pi watcher tests, strict typecheck, lint, syntax checks, and diff checks pass. The full branch-extension suite remains blocked by an unrelated stock-rendering fixture failure. The no-mistakes attestation failure is external because its test phase was skipped
…each main immediately without waiting for routine branch settlement; branch failures still re-wake main to avoid stranded rows. Added behavioral regression coverage and updated protocol docs. `tests/fm-pi-watch-extension.test.sh` and `bin/fm-lint.sh` pass. The no-mistakes attestation failure is pipeline-state-related, not a code defect
…ch failures now retain a replayable, main-only pending wake across delivery rejection or session replacement. Extended behavioral coverage to verify immediate decision delivery, preserved branch eligibility for routine rows, and retry after fallback rejection. `tests/fm-pi-watch-extension.test.sh`, `bin/fm-lint.sh`, and `git diff --check` pass. The branch-extension suite remains blocked by the pre-existing stock-render fixture failure. The no-mistakes attestation failure is pipeline-state-related, not a code defect
…jection now reuses an unconsumed main wake instead of submitting an identical concurrent follow-up. Updated behavioral coverage for the race. Verified Pi watcher tests, focused mixed-queue branch test, lint, and diff checks. The no-mistakes attestation failure is pipeline-state-related (`test` was skipped), not a code defect
…ocessing when branch rejection marks an in-flight main wake as main-only. Added regression coverage proving a rejected main delivery retries after grant release without concurrent duplication. Watcher tests, focused mixed-queue branch tests, lint, syntax, and diff checks pass. The no-mistakes attestation failure is external pipeline state (`test` skipped)
… signals now wait for the branch’s routine-row grant before waking main, preventing main from claiming the whole queue. Cleanup requests now reschedule while restoration is active, preserving retries after rejected main delivery. Added behavioral regression coverage. Verified fm-pi-watch-extension, targeted branch tests, shell syntax, diff checks, and fm-lint. The full branch suite still hits an unrelated pre-existing calm-rendering assertion. The no-mistakes attestation failure is pipeline state (test marked skipped), not a code defect
…running branch turn. Eligible routine rows are now reserved immediately, allowing main to receive decision rows without waiting while preserving branch ownership of routine rows. Added reservation cleanup, stale-owner recovery, documentation, and behavioral regressions. Relevant Pi watcher, branch routing, wake queue, typecheck, lint, and documentation checks pass. The no-mistakes attestation failure is pipeline-state related (test marked skipped), not a code defect
…on wakes by comparing the full pending state rather than token lists, preserving `mainOnly` mutations across session replacement. Added behavioral coverage proving the replacement reload wakes main without re-offering supervision. Pi watcher tests, targeted branch routing tests, lint, shell syntax, and diff checks pass. The no-mistakes attestation failure remains pipeline-state related (`test` skipped), not a code defect
…up errors from masking the intended lock-ownership fallback after supervision loses the fleet lock. Mixed queues still route routine rows to the branch and needs-decision rows to main. Focused branch regressions, the Pi watcher suite, lint, shell syntax, and diff checks pass. The no-mistakes attestation failure is pipeline-state-related because its test phase was skipped
Owner
Author
|
Superseded by #3776, which landed the needs-decision main-only routing with live validation. Closing per captain. |
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
Make every needs-decision event bypass the supervision branch and wake the main session directly, including product decisions, destructive choices, captain holds, second-mate escalations, and no-mistakes ask-user findings. Update watcher classification, branch-dispatch eligibility, documentation, generated Pi protocol, and tests so needs-decision signals are main-only while ordinary task-local heartbeat, signal, and stale routing remains unchanged. Keep the implementation narrowly limited to the signal path: do not extend it to stale, heartbeat, push-transition, or blocked events, and preserve normal branch routing for mixed queues containing routine notifications.
What Changed
Risk Assessment
✅ Low: The change is narrowly scoped, preserves heartbeat independence and mixed-queue ownership rules, and introduces no substantiated correctness or security defects.
Testing
Completed 1 recorded test check.
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed (4) ✅
.pi/extensions/fm-primary-pi-watch.ts:626- A mixed signal close does not wake main for its needs-decision row. Concrete path: task A appends needs-decision while task B emits a routine signal during the same grace window; A is excluded from the branch grant, B makes this offer eligible, and after successful branch settlement deliverActionableWake returns without calling sendWake. A remains queued but can stall indefinitely until an unrelated main turn or wake. Preserving B's branch routing while directly waking main for A requires coordinated split delivery/ownership behavior, so confirm and authorize that remedy rather than restoring the previously rejected whole-queue veto.🔧 Fix: Split mixed decision wakes between branch and main
1 error still open:
.pi/extensions/fm-primary-pi-watch.ts:623- The trigger correlation is key-wide rather than row-specific. Concrete path: an unread routinesignalrow fortask-a.statusremains queued, then the same task raises a needs-decision and closes assignal: task-a.status.scopeForUnreadWakereports the routine row as eligible and also includes that key inneedsDecisionKeys; this line consequently treats the single trigger key as needs-decision-only, marks the offer ineligible, and sends both rows to main. That violates the required mixed-queue behavior that routine notifications remain branch-eligible. Preserve both classifications for a key and split delivery whenever its unread rows include both ordinary and needs-decision signals.🔧 Fix: Preserve same-key mixed signal routing
1 error still open:
.pi/extensions/fm-primary-pi-watch.ts:657- Mixed routine/needs-decision wakes still do not wake main directly: delivery awaits the supervision branch's full model turn before calling sendWake. A slow or indefinitely pending branch prompt therefore delays the decision indefinitely without error. The new test masks this by accepting with an already-resolved settlement. Concurrent split delivery needs coordinated grant, pending-wake, and rejection semantics, so please authorize that behavior rather than extending the fixer machinery implicitly.🔧 Fix: Route mixed decision batches wholly to main
1 warning still open:
docs/supervision-protocols/pi.md:22- The requested generated Pi protocol was not updated. Its event-ownership paragraph still only refers generically to “main-only rows,” without stating that a needs-decision signal makes its coalesced signal/stale batch main-owned while heartbeat scans remain independent. This leaves the generated runtime contract less specific than the new behavior documented in docs/pi-supervision-branch.md; add the authorized routing rule here.🔧 Fix: Document needs-decision routing in Pi protocol
✅ Re-checked - no issues remain.
⏭️ **Test** - skipped
bin/fm-test-run.sh --changed --exclude-family real-herdr-gated✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.