Repository navigation
fix(watch): surface actionable events hidden by routine updates - #3195
kunchenguid wants to merge 19 commits into
Conversation
Confidence Score: 4/5The PR is not yet safe to merge because a same-key excluded reopening can cause an earlier live captain decision to be silently suppressed. The selector stores only the latest close position per key and applies it to every earlier relevant opening, so a close belonging to a later excluded reopening can hide an original decision that still requires supervisor action. Files Needing Attention: bin/fm-classify-lib.sh Reviews (3): Last reviewed commit: "no-mistakes(review): Index decision clos..." | Re-trigger Greptile |
A supervision wake covers every status byte appended since the previous one, but the watcher judged a status file by its newest line. A crew that raised a decision, reported review-ready PRs, hit a blocker, or finished a captain-requested release and install, and then appended any routine line, put the actionable event behind that newest line, so the whole batch classified as routine and the wake was absorbed when the crew looked provably working. Nothing looked at the file again, because the fleet catch-all read the last line too, so the work stalled with no supervisor turn at all. fm-classify-lib.sh gains last_captain_relevant_status_line, the one statement of "what must firstmate be shown about this file" as distinct from last_status_line's "what is this crew's current declaration". The per-wake watcher triage and the fleet catch-all both read it, so an event behind a routine append can no longer go blind, and a terminal release or install completion surfaces and wakes the main session rather than being classified routine. The stale path keeps its last-line reading, because a declared pause is a statement about current state, and a non-terminal stale pane still escalates on the wedge timer. Regression coverage drives the real watcher through the reproduced batch, the terminal release and install completion, and the classifier-level statement that a routine-only status is still not actionable.
…actionable events
…he same batch The batch reader scans only captain-relevant records, and resolved: and captain-held: are deliberately not captain-relevant. A crew that raised a keyed decision and then closed it before the next wake therefore still returned the opening event, so the watcher queued a supervisor turn and annotated it with an action that was already closed. The drain listed no open decision at all, which is exactly the over-surfacing this reader must avoid. last_captain_relevant_status_record now consults status_open_decisions, the one authoritative statement of what is still open, rather than re-deriving the rule. A needs-decision: or blocked: whose key that fold reports closed is skipped; a still-open one behind a later routine append keeps surfacing, which is the stall this change exists to fix. Every uncertain case keeps the event: a status path the fold cannot be trusted to read, an unparsable key, and a transition the fold itself would refuse all surface as before. Surfacing a closed decision costs one wasted turn, while dropping a live one restores the silent stall. Regression coverage drives both directions through the classifier and through the real watcher: a decision opened and closed in one batch is absorbed with no exit and no queued wake, and an open decision behind a routine append still surfaces.
ad6bb88 to
810b2c0
Compare
The reader asked whether a decision key was open at end of file, so a home that overrides captain-relevance through FM_CAPTAIN_RE could have a reopening its own rule excludes put the key back into the open set while never becoming a candidate itself. The already-resolved opening line was returned, and the watcher raised a supervisor turn whose stated reason was a decision that had been resolved earlier in the same batch. The question is whether THIS event was closed after it, not whether its key is open at the end. A closing record now retires the candidate it closes, so a later reopening the caller's own relevance rule excludes cannot resurrect the stale line, while a genuinely captain-relevant reopening simply becomes the candidate itself. Closing verbs are never captain-relevant, so retiring on one can never drop a live candidate. Key parsing and the legal transitions stay with _fm_decision_key and _fm_decision_key_transition_allowed, so this reads the existing grammar rather than restating it. An unparsable key, a transition those owners refuse, and an unreadable status path all keep the event: surfacing a closed decision costs one wasted turn, while dropping a live one restores the silent stall. Regression pins the documented-override corner through the classifier: an excluded reopening cannot resurface the resolved event, and a relevant one surfaces as itself.
| [ -n "$close_position" ] && [ "$close_position" -gt "$count" ] && continue | ||
| fi |
There was a problem hiding this comment.
When a captain-relevant opening is followed by an FM_CAPTAIN_RE-excluded reopening of the same key and then a close for that reopening, the selector applies that latest close to the original opening. This omits the still-live decision from signal triage and heartbeat recovery, allowing the batch to be absorbed without waking the supervisor.
|
Superseded by #3268, the clean-base replay of this fix (merged). Closing this abandoned pre-replay PR. |
Intent
Fix actionable project updates being misclassified as ROUTINE by Firstmate's supervision/classification, so a worker that stopped, raised a decision, or hit a blocker no longer stalls SILENTLY.
SCOPE (captain-corrected, and deliberately narrow): correct ONLY the routing/classification of ACTIONABLE EVENTS between the SUPERVISION session and the MAIN session. Away-mode is explicitly OUT OF SCOPE. Do NOT add, restore, or request any change to bin/fm-supervise-daemon.sh, the away-mode daemon, away-mode-only tests, docs, or state, byte-position cursors, or legacy-record migration policy. An earlier expanded attempt covering those was superseded by the captain and must not return. If a finding would pull the change into away-mode, byte cursors, or legacy migration, that is out of scope for this task rather than something to fix here.
OBSERVED USER EXPERIENCE the fix must eliminate:
CAUSE AND FIX:
One supervision wake covers every status byte appended since the previous one, but the watcher judged a status file by its NEWEST line. A crew that raised a decision, reported a review-ready PR, hit a blocker, or finished a captain-requested RELEASE/INSTALL completion, and then appended any routine line (working:, resolved:, a declared pause), put the actionable event BEHIND that newest line, so the whole batch classified as routine and the wake was absorbed while the crew looked provably working. The fleet catch-all read the last line too, so nothing looked again and the work stalled with no supervisor turn at all.
bin/fm-classify-lib.sh gains last_captain_relevant_status_line: the single statement of "what must firstmate be shown about this file", as distinct from last_status_line's "what is this crew's current declaration". The per-wake watcher triage and the fleet catch-all both read it, so an actionable event behind a routine append can no longer go blind, and a terminal captain-requested release/install completion surfaces and wakes the main session instead of classifying as routine. The fix must not over-surface: a routine-only status stays routine.
The stale path deliberately KEEPS its last-line reading, because a declared pause is a statement about current state, and a non-terminal stale pane still escalates on the wedge timer.
ADDITIONAL ACCEPTED REQUIREMENT (from a vetted Greptile finding, captain-authorized): a keyed decision that the SAME batch also closed must NOT raise a supervisor turn. A needs-decision: or blocked: whose matching resolved: or captain-held: already landed is closed, and raising a wake for it is exactly the over-surfacing this reader must avoid. status_open_decisions is the one authoritative statement of what is still open, so the reader consults that fold rather than re-deriving the rule. Every uncertain case still keeps the event: an untrusted status path, an unparsable key, and a transition the fold itself would refuse all surface as before, because surfacing a closed decision costs one wasted turn while dropping a live one restores the silent stall. A still-OPEN decision behind a later routine append must keep surfacing.
REGRESSION COVERAGE (behavioral, through an executable interface; never asserting implementation-source bytes, tokens, or snapshots): the reproduced hidden-actionable batch driven through the real watcher, the terminal release/install completion surfacing and waking the main session, and the classifier-level statement that the batch question is not the last-line question while a routine-only status is still not actionable.
DELIVERY REQUIREMENTS:
PUBLIC FOLLOW-UP OBLIGATION (preserve, do not drop): when this work reaches its promised terminal outcome (PR merged), a concise PUBLIC-SAFE outcome sentence plus the PR URL must be reported to firstmate through the routed status line, so the main home can run its typed terminal public-followup emit (obligation pf-actionable-update-escalation-fix-r1, relation rel-fmdev-f1-actionable-update-escalation-fix-r1, source-home secondmate:fmdev-f1, work-id fm-actionable-update-escalation-misclassification-r1, generation 1, outcome pr-merged). Nothing is posted publicly from this branch and the thread is never sought here.
DESIGN ALREADY ACCEPTED AND NOT TO BE REOPENED: the shared scanner scan_captain_relevant_statuses has an explicit OPT-IN full-batch mode. Both main-session watcher paths (per-notification triage and heartbeat recovery) opt in; the away-mode daemon call site in bin/fm-supervise-daemon.sh does NOT opt in and keeps the existing default semantics with no observable behavior change. Records carry an occurrence count before the free-form status line and are parsed without IFS splitting, so status text containing consecutive or trailing tabs stays byte-identical. Do not reopen these.
FURTHER ACCEPTED REQUIREMENT (vetted Greptile finding on the documented FM_CAPTAIN_RE operator override, captain-authorized): the reader must not resurface an event that a LATER line already closed. Asking whether a decision key is open at end of file is not sufficient: a home that overrides captain-relevance through FM_CAPTAIN_RE can have a reopening its own rule excludes, which puts the key back into the open set while never becoming a candidate, so the already-resolved opening line was returned and the watcher raised a supervisor turn naming a decision resolved earlier in the same batch. A closing record must retire the candidate it closes, so an excluded reopening cannot resurrect the stale line while a genuinely captain-relevant reopening becomes the candidate itself. Key parsing and legal transitions stay with _fm_decision_key and _fm_decision_key_transition_allowed rather than being restated. An unparsable key, a refused transition, and an unreadable status path all keep the event.
PROCESS NOTE: two earlier runs on this work each lost 30 minutes to a no-mistakes fix agent that went silent and timed out (run 01M12A1EDV4CC16CSBCP6NEWF7 at the review step, run 01M12PPCPPK0MFWMRG952X5BCK at the CI step). That is being tracked separately as a no-mistakes product defect and is NOT something this change should work around or accommodate.
What Changed
Risk Assessment
🚨 High: The implementation contradicts an explicit acceptance criterion governing the authoritative decision-liveness boundary and should not merge without user review.
Testing
The targeted watcher triage suite passed, including hidden actionable batches, heartbeat recovery, closed and reopened keyed decisions, tab-preserving deduplication, and unchanged default scan behavior; a manual real-watcher demonstration showed a release completion followed by routine work waking and durably queuing the main session, while the out-of-scope away-mode files remained byte-identical to the base.
Evidence: Real watcher actionable-routing transcript
Source: Real watcher actionable-routing transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-classify-lib.sh:143- The intent requires that “A still-OPEN decision behind a later routine append must keep surfacing,” but clearing the singlerelevantcandidate loses earlier open decisions. Forneeds-decision [key=k1], thenneeds-decision [key=k2], thenresolved [key=k2], thenworking:, the resolution clears k2 and the function returns no record even though k1 remains open; both watcher paths can therefore absorb the batch and restore the silent stall. At this shared reader boundary, retire the closed keyed candidate while retaining or recovering the latest earlier eligible event, using the authoritative fold semantics.🔧 Fix: Preserve earlier live decisions after newer closures
1 error still open:
bin/fm-classify-lib.sh:124- The intent requires that “an unreadable status path ... must all keep the event,” but a failedcatreturns success with no record. For a changed unreadable.statusbelonging to a provably-working crew,signal_reason_is_actionabletherefore returns false, the signal is absorbed, and the heartbeat scanner also skips it. Preserve read failure as an actionable result at this shared reader boundary instead of making it indistinguishable from a routine-only file.🔧 Fix: Surface unreadable status files as actionable
2 errors still open:
bin/fm-classify-lib.sh:1381- The required rule says an “untrusted status path ... must keep the event,” and the reader emits an actionable record for a dangling symlink, but both signal triage here and the full-batch scanner at line 1588 skip it because[ -e ]follows the missing target. Accept.statussymlinks into the shared reader so its untrusted-path handling can surface them.bin/fm-classify-lib.sh:125- The constantread-errorrecord cannot preserve either the prior surfaced occurrence or a distinct read-failure episode. After occurrence 10 surfaces, temporary unreadability overwrites its marker withread-error; restoring the unchanged file then re-queues occurrence 10. Conversely, unreadable -> readable routine-only -> unreadable again is suppressed because the second failure has the same record. Preserve the successful occurrence watermark while giving read failures a deduplicable episode identity.🔧 Fix: Remove out-of-scope unreadable status fail-safe
2 issues (1 error, 1 warning) still open:
bin/fm-classify-lib.sh:133- The intent requires that “status_open_decisions is the one authoritative statement of what is still open, so the reader consults that fold rather than re-deriving the rule,” but this reader independently recognizes opening and closing verbs and computes per-key closure positions without consulting that fold. Route liveness/closure-position selection through the existing_fm_decision_fold_linesemantic boundary, or extend that boundary to expose the required position data.bin/fm-classify-lib.sh:159- For every captain-relevant decision, the second pass scans the complete closure list. A status containing 5,000 openings and 5,000 closures performs roughly 25 million shell-loop iterations on every signal classification and heartbeat fleet scan, potentially blocking supervision as append-only logs grow. Index closure positions once per key or integrate position tracking into the authoritative fold.🔧 Fix: Index decision closures for linear selection
1 error still open:
bin/fm-classify-lib.sh:133- The required contract says “status_open_decisions is the one authoritative statement of what is still open, so the reader consults that fold rather than re-deriving the rule,” but this reader independently recognizes opening and closing verbs and builds per-key closure positions. Route selection through_fm_decision_fold_line, or extend that authoritative boundary to expose closure-position data, so future fold semantics cannot diverge and silently drop live decisions.✅ **Test** - passed
✅ No issues found.
bash tests/fm-watch-triage.test.shbash ~/.no-mistakes/evidence/01M12YWPZRYESBKX7D6FXTNT6K/actionable-routing-demo.sh | tee ~/.no-mistakes/evidence/01M12YWPZRYESBKX7D6FXTNT6K/actionable-routing-transcript.txtgit diff --quiet bca584a840011079a121fe965a222eb5a3578408 -- bin/fm-supervise-daemon.sh .agents/skills/afk/SKILL.mdbash -n bin/fm-classify-lib.sh bin/fm-push-transition-lib.sh bin/fm-watch.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.