Skip to content

fix(watch): stop repeated stale wakes for held decisions, merge-ready tasks, and active pipeline steps - #4336

Open
tim-akihiro wants to merge 2 commits into
kunchenguid:mainfrom
tim-akihiro:fm/fm-stale-trotz-captain-hold
Open

tim-akihiro wants to merge 2 commits into
kunchenguid:mainfrom
tim-akihiro:fm/fm-stale-trotz-captain-hold

Conversation

@tim-akihiro

Copy link
Copy Markdown

Intent

Firstmate weckt unnoetig, wenn eine Aufgabe auf den Auftraggeber wartet. Gemessen 04.09.2026 an i8-historie-verursacher-lesbar: ein Ship-Arbeiter, der mit "needs-decision:" parkt und dessen Backlog-Aufgabe per bin/fm-captain-hold.sh hold sauber gehalten wird, loest weiter alle paar Minuten eine stale-Weckung aus. Drei Mal hintereinander beobachtet, jedes Mal ohne Handlungsbedarf.

Ursache, bereits eingegrenzt: fm-watch.sh absorbiert eine ruhige Endstelle nur, wenn die LETZTE Statuszeile das Verb "paused" oder "captain-held" traegt (bin/fm-classify-lib.sh:169 status_is_captain_held, bin/fm-watch.sh:866). Hier ist die letzte Zeile aber "needs-decision:". Die Zeile "captain-held [key=...]" schreibt nach heutigem Stand nur bin/fm-captain-hold.sh complete, und complete ist das Abschluss-Gate einer Untersuchung, nicht der richtige Aufruf fuer eine laufende Ship-Aufgabe mitten in der Arbeit. "paused:" waere fachlich falsch, das meint laut Vertrag eine begrenzte aeussere Wartezeit, die sich von selbst aufloest.

ZWEITER FALL desselben Lochs, gemessen 04.09.2026 an i8-prove-spot-buchungspfad: eine fertige Ship-Aufgabe, deren letzte Statuszeile "done:" traegt und die nur noch auf die Merge-Freigabe wartet, weckt aus demselben Grund weiter mit stale.

DRITTER, VERWANDTER FALL, gemessen 04.09.2026 an i8-historie-verursacher-lesbar: ein Arbeiter, der seine Arbeit in Hintergrund-Shells laufen laesst, zeigt eine unveraenderte Endstelle, waehrend bin/fm-crew-state.sh korrekt "working, run-step validating (running)" meldet. Der Keil-Melder feuert trotzdem im 240-Sekunden-Takt, drei Mal hintereinander beobachtet.

What Changed

  • fm-watch.sh's wedge timer now rechecks the authoritative crew state at the escalation boundary instead of trusting only the classification-time snapshot: an actively running pipeline step resets the quiet timer, and a done: task with a still-open captain call also absorbs instead of escalating.
  • fm-classify-lib.sh splits crew-state classification into crew_current_class (raw run-step/pane/paused/none) plus a new crew_has_active_run_step predicate, so callers can distinguish "provably working via an active run-step" from "provably working via a pane" where before both collapsed into a single working verdict.
  • fm-captain-hold.sh adds transfer_matching_status_decision, called from command_hold: when a held backlog task's id exactly matches an open keyed decision in its origin's status stream, hold appends a verified captain-held [key=...] transfer line to that stream, closing the live copy while the backlog task remains the durable record.
  • fm-watch.sh tracks a new .paused-override-<key> marker so a pane that was provably working under a declared pause, but later becomes inconclusive, still runs the wedge-timer recheck instead of falling back to the low-urgency declared-pause cadence.
  • Updated docs/architecture.md, docs/configuration.md, and docs/captain-hold-lifecycle.md to describe the new absorption paths; added coverage in tests/fm-watch-triage.test.sh and tests/fm-captain-hold-lifecycle.test.sh.

🤖 Generated with Claude Code

Risk Assessment

✅ Low: Change is well-scoped, addresses exactly the three measured cases in the intent (captain-held transfer on hold, done+open-captain-call wedge suppression, active run-step wedge suppression), reuses existing predicates/helpers correctly, and is backed by behavioral (not source-grep) tests for all three scenarios plus a mismatch/negative case.

Testing

Targeted bash tests/fm-captain-hold-lifecycle.test.sh and bash tests/fm-watch-triage.test.sh (the two suites the diff modified) both exit 0 with every ok assertion, directly covering all three cases in the user intent (needs-decision parked-on-decision absorption via captain-held tagging, done+merge-pending no longer stale-waking, and wedge-melder deferring to an active pipeline step) while retaining coverage that real wedges still surface — no findings, worktree left clean.

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-captain-hold-lifecycle.test.sh (exit 0, 33/33 assertions ok — covers fm-captain-hold.sh hold now appending captain-held [key=...] for open status decisions)
  • bash tests/fm-watch-triage.test.sh (exit 0, all assertions ok — covers needs-decision/captain-held absorption, done+merge-approval-pending absorption, and wedge-escalation held back by an active fm-crew-state.sh pipeline step, plus regression coverage that genuinely stuck/stale panes still surface)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

… tasks, and active pipeline steps

fm-watch.sh only absorbed a quiet endpoint when the crew's last status line
carried paused or captain-held, so a ship task parked with needs-decision:
under a clean captain-hold, or a done: task only waiting on merge approval,
kept re-triggering stale wakes every poll.

- fm-captain-hold.sh hold now appends the captain-held transfer itself when
  the held task id matches an open keyed decision in its status stream, so
  the status log agrees with the backlog without needing the investigation
  complete gate.
- wedge_timer_check absorbs a completed task with an open captain call
  (merge approval) instead of escalating it as a possible wedge.
- wedge_timer_check rechecks fm-crew-state's authoritative run step at the
  wedge boundary and resets the timer while a pipeline step is actively
  running, instead of alarming on an unchanged pane whose work is happening
  in a background shell.
- A declared-pause window already wedge-tracked because it was overridden by
  an active run step now keeps tracking (via a dedicated override marker)
  once that step stops, instead of silently falling back to the low-urgency
  paused recheck cadence and hiding a real wedge.

Each case has a test pinning the absorb/report boundary so a genuinely
stalled task still surfaces.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant