Skip to content

fix(watch): surface paused waits superseded by gates or terminal runs - #8014

Merged
kunchenguid merged 11 commits into
kunchenguid:mainfrom
Dematom1:fm/fm-watch-pause-gate
Nov 11, 2026
Merged

kunchenguid merged 11 commits into
kunchenguid:mainfrom
Dematom1:fm/fm-watch-pause-gate

Conversation

@Dematom1

@Dematom1 Dematom1 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Surface paused waits that hide an unreported human-owed gate or terminal run, while suppressing repeat alerts for the same declaration and run.

What Changed

  • Surface a declared paused wait when its run is parked at a human-owed gate without a matching open decision, or when the run is terminal, on idle and busy paths.
  • Throttle repeat alerts by declaration and run while preserving ordinary paused-wait cadence; cover gate, terminal, open-decision, working-run, and busy-pane cases.

Risk Assessment

Testing

At 20:05, a captain question was recorded as paused. At 20:11:59, a validation wait through 20:19 was declared, but its due recheck at 20:19:47 did not surface the task. From 20:22:29 to 00:19:27, 757 stale observations were absorbed while the validation run was parked on a human-owed finding before 20:38. The long-cadence wake arrived at 00:19:45; the supervisor surfaced the finding at 00:20:14; needs-decision was recorded at 00:20:41 and resolved at 00:21:17. A related approval reported at 20:37:38 had been waiting since about 20:00. The change surfaces an unreported human-owed gate or terminal run and suppresses repeats for the same declaration and run.

  • The complete FM_LIVE=0 tests/fm-watch-triage-pause.test.sh suite passed after the busy-repeat fix. No live/Lavish tests were run, as required.
  • No-mistakes review, test, documentation, and lint steps completed. The live-validation-only Test finding was approved under the task contract. The Full suite check failed at the maintainer-controlled full-ci label prerequisite (FM_CI_FULL=false), so no full test lane ran; this expected exception was approved.
  • PR must be raised via no-mistakes passed.

Live validation

  • Scenario 1: passed. Command: live-watcher.sh (private tmux socket; real bin/fm-watch.sh; idle worker pane; captured no-mistakes parked ask-user fixture; FM_PAUSE_RESURFACE_SECS=20). Captured: 23:54:22Z stale: live:fm-fm-8014-live-e2e (paused wait superseded: run 01M20NDQH0G96AQYH1EHWGKT5F is parked at a human-owed gate with no open decision); the next 15 seconds produced no repeat.
  • Scenario 2: passed. Command: live-watcher.sh (private tmux socket; real watcher; terminal-run fixture; idle worker pane). Captured: 23:54:57Z stale: live:fm-fm-8014-live-e2e (paused wait superseded: current run 01M20NDQH0G96AQYH1EHWGKT5F is terminal (done)); the next 15 seconds produced no repeat.
  • Scenario 3: passed. Command: live-watcher.sh (private tmux socket; real watcher; idle worker pane; captured parked ask-user fixture). Captured one gate-superseded wake at 23:54:22Z; no repeat in the following 15 seconds.
  • Scenario 4: passed. Command: live-watcher.sh (private tmux socket; real watcher; busy worker pane running sleep; captured parked ask-user fixture). Captured one gate-superseded wake at 23:54:41Z; no repeat in the following 15 seconds.
  • Control: the working-run idle-pane case emitted no superseded wake during its 8-second observation.
  • The test cadence was accelerated to 20 seconds; the ask-user and terminal run data came from the repository's established genuine no-mistakes capture, not a newly started live validation run. Full transcript retained with the validation artifacts.

Opt-in

This change is opt-in. It is off by default; enable it per home with touch config/paused-wait-supersession (home-local, not inherited by second mates). The superseded-pause check (a declared pause hiding a human-owed gate or a finished run) runs only when this flag exists. Without it, the watcher is identical to main and spends no extra crew-state read on paused polls. Away mode keeps its existing pause cadence either way. See the config/paused-wait-supersession section in docs/configuration.md.

Risk Assessment

⚠️ Medium: The change is narrowly scoped and honors the foreground-only/opt-in requirements, but terminal state is not tied to the paused declaration's run and can generate a false wake for an unrelated run.

Testing

Ran the three focused behavior cases for supersession, opt-in compatibility, and away-mode exclusion; all passed. They drive the actual watcher through test doubles, not a live tmux lab. The prescribed external lab requires intentional /tmp writes, so live validation was not completed.

  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Opted-in declared wait surfaces unreported gates and terminal runs; working and answered states remain quiet ⏸️ untested no Executed the focused watcher test, but it uses fake tmux and crew-state processes. The prescribed live lab driver is outside the worktree and writes intentionally under /tmp; workspace-boundary rules…
Without opt-in, declared-wait cadence and crew-state reads remain unchanged ⏸️ untested no Executed the focused watcher test, but it uses fake tmux and crew-state processes. The prescribed live lab driver is outside the worktree and writes intentionally under /tmp; workspace-boundary rules…
Away mode retains the declared-wait cadence when supersession is opted in ⏸️ untested no Executed the focused watcher test, but it uses fake tmux and crew-state processes. The prescribed live lab driver is outside the worktree and writes intentionally under /tmp; workspace-boundary rules…
Evidence: Focused pause behavior checks
ok - declared waits surface unreported gates and terminal runs once, while working runs and answered gates keep the pause cadence on idle and busy paths
ok - without config/paused-wait-supersession superseding states keep the declared-wait cadence and spend no extra crew-state read
ok - with the away-mode flag present an armed busy paused worker at a human gate behaves exactly as with the flag absent: no superseded wake and no crew-state read
  • Outcome: ⚠️ 2 warnings across 2 runs (4m52s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

⚠️ **Review** - 1 warning
  • ⚠️ bin/fm-watch.sh:2454 - paused_wait_superseded only surfaces the gate when the parked run ID matches, but terminal detection accepts any done/failed crew state and labels it current without binding it to the declared wait. A concrete state with paused: waiting for validation run R1 and state: done · source: run-step · run: R2 wakes on the unrelated R2 completion, violating the documented contract that the declared wait is superseded by its run. Bind terminal state to the run ID parsed from the paused declaration (or otherwise establish identity); sibling evaluation sites: bin/fm-watch.sh:2512 and bin/fm-watch.sh:3088 call this predicate from idle and busy paths.
⚠️ **Test** - 2 warnings
  • ⚠️ bin/fm-watch.sh:1 - This phase exercised the focused watcher scenarios through the repository's executable test harness, which uses tmux/crew-state test doubles rather than a real isolated watcher product session. Prior attempts documented that the prescribed tmux lab exposed fleet sessions. A safe real-watcher lab was not completed in this turn, so live end-user behavior remains unverified.
  • ⚠️ live validation verdict: inconclusive (0 of 3 scenarios were driven live against the product); untested: Opted-in declared wait surfaces an unreported gate or its terminal run; working and answered states stay quiet, Without opt-in, declared-wait cadence remains unchanged, Away mode keeps its declared-wait cadence even when supersession is opted in
  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Opted-in declared wait surfaces an unreported gate or its terminal run; working and answered states stay quiet ⏸️ untested no Focused executable test ran watcher logic using tmux and crew-state test doubles, not the real running watcher. No isolated tmux lab was driven in this turn.
Without opt-in, declared-wait cadence remains unchanged ⏸️ untested no Focused executable test ran with test doubles; live isolated watcher session was not driven.
Away mode keeps its declared-wait cadence even when supersession is opted in ⏸️ untested no Focused executable test asserted absence of wake/read under doubles; real watcher in a safe isolated session was not exercised.
  • for t in test_declared_wait_surfaces_superseding_state test_superseded_wait_check_is_opt_in test_superseded_wait_check_skips_away_mode; do FM_TEST_ONLY="$t" bash tests/fm-watch-triage-pause.test.sh || exit; done

🔧 No changes applied.
2 warnings still open:

  • ⚠️ bin/fm-watch.sh:1 - The watcher change has a runnable live product surface, but this phase did not exercise it in a private real watcher/tmux lab. The earlier prescribed lab driver writes its outputs under /tmp and lives outside the worktree; running it as instructed would make intentional out-of-worktree writes prohibited by the workspace boundary. The available focused tests execute the real watcher with tmux and crew-state doubles, so they do not substitute for a live lab.
  • ⚠️ live validation verdict: inconclusive (0 of 3 scenarios were driven live against the product); untested: Opted-in declared wait surfaces unreported gates and terminal runs; working and answered states remain quiet, Without opt-in, declared-wait cadence and crew-state reads remain unchanged, Away mode retains the declared-wait cadence when supersession is opted in
  • Live validation: ⚠️ inconclusive - 0 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Opted-in declared wait surfaces unreported gates and terminal runs; working and answered states remain quiet ⏸️ untested no Executed the focused watcher test, but it uses fake tmux and crew-state processes. The prescribed live lab driver is outside the worktree and writes intentionally under /tmp; workspace-boundary rules…
Without opt-in, declared-wait cadence and crew-state reads remain unchanged ⏸️ untested no Executed the focused watcher test, but it uses fake tmux and crew-state processes. The prescribed live lab driver is outside the worktree and writes intentionally under /tmp; workspace-boundary rules…
Away mode retains the declared-wait cadence when supersession is opted in ⏸️ untested no Executed the focused watcher test, but it uses fake tmux and crew-state processes. The prescribed live lab driver is outside the worktree and writes intentionally under /tmp; workspace-boundary rules…
  • bash -n bin/fm-watch.sh tests/fm-watch-triage-pause.test.sh
  • FM_LIVE=0 FM_TEST_ONLY=test_declared_wait_surfaces_superseding_state bash tests/fm-watch-triage-pause.test.sh
  • FM_LIVE=0 FM_TEST_ONLY=test_superseded_wait_check_is_opt_in bash tests/fm-watch-triage-pause.test.sh
  • FM_LIVE=0 FM_TEST_ONLY=test_superseded_wait_check_skips_away_mode bash tests/fm-watch-triage-pause.test.sh
  • git diff --check bb3b2d6951d021fcd085478b3c04f6ea16b22ba8 49c992d4825f62b0d542c976e7459e48cfac9cc2
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the previous away-mode issue is fixed.

Reviews (9) · Last reviewed commit: "fix(watch): skip the superseded-wait che..." · Reviewed by Greptile

Comment thread bin/fm-watch.sh Resolved
Comment thread tests/fm-watch-triage-pause.test.sh Resolved
Comment thread bin/fm-watch.sh Resolved
… before the busy-turn age gate, and reused captured crew state for gate classification. Added real busy-pane coverage for recent and old turns. Shell syntax, the targeted test, and `git diff --check` pass
Comment thread bin/fm-watch.sh Resolved
@Dematom1 Dematom1 changed the title fix(watch): surface paused waits superseded by gate or terminal state fix(watch): surface paused waits superseded by gates or terminal runs Oct 31, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @Dematom1, and thanks for the detailed incident timeline. It makes the gap easy to see. On head 77a63f8a, a declared paused wait now surfaces once per declaration and run when its run is parked at a human-owed gate with no open decision, or when the run is terminal. That works on both the idle and busy paths, and repeats are held to the normal pause cadence. Your no-mistakes run binds this head with no skipped steps, all four Greptile threads are resolved, and the quick checks pass.

Waiting on you for one thing: live validation on this head is inconclusive (0 of 4 scenarios driven live). When you have a moment, could you run it once against a real watcher? For example, a real worker that declares a paused wait while its no-mistakes run parks on an ask-user authority finding. Then post the stale: … (paused wait superseded: …) wake and show that no repeat fires inside the cadence. Re-raising through git push no-mistakes with live validation enabled works just as well.

Contract-class (my own read): new-default. The default watcher gains a new wake reason that fires ahead of the existing FM_PAUSE_RESURFACE_SECS cadence. It also does an extra crew-state read on each paused poll. So once the live evidence is in and the Full suite is green, this goes to Kun for the decision. That part is waiting on Kun, not you. VISION: it aligns, since an escalation should exist for a decision only a human can make, and a declared wait must not hide one. Note that #7997 touches the same pause cadence and is still open. Any overlap there is ours to sort out, not yours.

@Dematom1

Copy link
Copy Markdown
Contributor Author

Live validation was not completed: 0/4 scenarios were driven. I provisioned the isolated lab home and Herdr session, but did not establish the real worker or the throwaway sandbox repository with a parked no-mistakes ask-user run, so there is no watcher wake or cadence evidence to report. I updated the validation rows to mark them untested and preserved the brief, Updates line, and pipeline attestation. Please run the live scenario when a worker and parked run are available.

@Dematom1

Copy link
Copy Markdown
Contributor Author

Live validation update for #8014: I drove the real watcher from this PR against a private tmux server and stub worker pane. The genuine captured no-mistakes ask-user gate produced one idle-path wake and one busy-path wake; neither repeated during the following 15 seconds under a 20-second accelerated pause cadence. A terminal-run fixture also produced one wake with no repeat, and the working-run control produced none. The gate and terminal data used the repository\x27s established genuine no-mistakes capture rather than a newly started live run. I updated the four validation rows with the command and captured evidence. The required PR must be raised via no-mistakes check passes; Full suite remains failed at the previously documented full-ci label prerequisite.

Gate paused_wait_superseded behind the home-local config/paused-wait-supersession
presence flag and move its crew-state read inside the gate, so a home without
the flag keeps main's declared-wait cadence, wording, and crew-state reads.
@Dematom1 Dematom1 changed the title fix(watch): surface paused waits superseded by gates or terminal runs fix(watch): make paused-wait supersession opt-in Nov 8, 2026
Comment thread bin/fm-watch.sh Resolved
Comment thread bin/fm-watch.sh Resolved
…ent, preserving distinct throttles when PR suffixes follow; added coverage for two terminal PR-bearing runs. Documented foreground-only scope and unchanged away-mode cadence in both requested locations. `FM_LIVE=0 bash tests/fm-watch-triage-pause.test.sh` passed the new and opt-in cases, then timed out after 8/31 tests (300s)
@Dematom1 Dematom1 changed the title fix(watch): make paused-wait supersession opt-in fix(watch): surface paused waits superseded by gates or terminal runs Nov 8, 2026
@kunchenguid kunchenguid added the full-ci Maintainer go-ahead: run the full CI suite on this outside pull request label Nov 8, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @Dematom1. I read head 270367fa against main 3e9c781d. The superseded-pause check is now behind config/paused-wait-supersession. Without that flag, paused_wait_superseded returns before it reads anything. That means no extra crew-state read and no new wake, and the throttle-cleanup branch only handles scopes the opt-in path writes. Your no-mistakes live lab shows an unarmed watcher matching main in cadence and read count. Armed, it surfaces both the gate case and the terminal case once. You fixed Greptile's "Finished runs share silence" P1 in 270367fa. The away-mode note is covered by your documented foreground-only scope, which Greptile accepts at 5/5. Every thread is resolved. The attestation binds 270367fa with every step completed, and the quick checks pass.

Contract-class (my own read): opt-in. That replaces my Oct 31 new-default read, which was on a head before the flag existed. VISION: aligns rule by rule. A declared wait no longer hides a human-owed gate or a finished run, the feature is off unless the home opts in, and the predicates and throttle are exact.

I've queued the full suite with the full-ci label. Nothing more is needed from you unless a lane fails on this change. #7997 touches the same pause cadence, and any overlap there is ours to sort out.

@kunchenguid kunchenguid added full-ci Maintainer go-ahead: run the full CI suite on this outside pull request and removed full-ci Maintainer go-ahead: run the full CI suite on this outside pull request labels Nov 9, 2026
# Conflicts:
#	bin/fm-watch.sh
#	docs/configuration.md
Comment thread bin/fm-watch.sh Resolved
paused_wait_superseded returned only on the absent opt-in flag, so its
busy-path and secondmate callers still read crew state and could queue a
superseded wake while the away-mode flag existed, contrary to the documented
foreground-only scope. Return before any read while afk_present.
@kunchenguid
kunchenguid merged commit 47df77f into kunchenguid:main Nov 11, 2026
25 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @Dematom1 — really appreciate you taking the time on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Maintainer go-ahead: run the full CI suite on this outside pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants