Skip to content

fix(watch): hold the declared-wait cadence across pane churn - #3594

Open
withally wants to merge 1 commit into
kunchenguid:mainfrom
withally:upstream/declared-wait-cadence
Open

withally wants to merge 1 commit into
kunchenguid:mainfrom
withally:upstream/declared-wait-cadence

Conversation

@withally

@withally withally commented Sep 3, 2026

Copy link
Copy Markdown

Problem

A live worker on a current declared wait can keep emitting stale wakes when its status log appends another still-declaring line.
The status-file signature changes on every append, so the watcher treats each append as a new cadence even though the wait never ended.

The regression was added and run against upstream/main at 353a8f0f before the implementation:

FM_TEST_BEGIN 2026-09-03T02:55:59Z tests/fm-watch-triage.test.sh family=watcher-wake-lock expected_gate_skip=none
not ok - declaring status appends re-armed the stale path (4 stale wakes in total)
FM_TEST_END 2026-09-03T03:00:25Z tests/fm-watch-triage.test.sh exit=1 duration_ms=265712 gate_skip=false
FM_TEST_SUMMARY total=1 failed=1 skipped_gate=0 duration_ms=265781

Fix

Treat the live-agent inspection as one-shot once the declaration-held pause marker exists.
Keep the long-cadence throttle across pane changes, watcher restarts, and later paused: or same-key captain-held appends.
Continue to clear the cadence when the last status stops declaring a wait or authoritative state proves work resumed.
Keep needs-decision, blocked, and done immediately actionable on both signal and stale paths.

Tests

  • bin/fm-test-run.sh tests/fm-watch-triage.test.sh - passed, 1 suite and 0 failures.
  • bin/fm-lint.sh - passed with ShellCheck 0.11.0 and actionlint 1.7.12.
  • bin/fm-doc-audience-check.sh - passed with 89 surfaces and 302 local links.
  • git diff --check - passed.

A broader bin/fm-test-run.sh --changed --base upstream/main run passed 17 of 18 selected suites.
The unrelated tests/fm-wake-queue.test.sh lock fixture failed immediately with a subshell reclaimed its parent live hold (rc=13) and reproduced standalone; this patch does not modify its lock implementation or fixture.

Evidence

The final commit is based directly on current upstream/main 1c00e86c.
The regression now reports:

ok - a current declared wait holds its long cadence across pane churn, declaring appends and watcher restarts
ok - needs-decision, blocked and done still wake immediately through an armed declared-wait cadence
FM_TEST_SUMMARY total=1 failed=0 skipped_gate=0 duration_ms=488812

The diff is limited to bin/fm-watch.sh, tests/fm-watch-triage.test.sh, and the watcher contract in docs/architecture.md.

@greptile-apps

greptile-apps Bot commented Sep 3, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

The PR should not merge until distinct replacement waits are prevented from inheriting an unrelated declaration's long suppression window.

Timestamp-only pause throttling suppresses a changed pause reason or captain-held key because both signal and stale handling continue to treat it as the already-inspected declaration.

Files Needing Attention: bin/fm-watch.sh, tests/fm-watch-triage.test.sh

Reviews (1): Last reviewed commit: "fix(watch): hold the declared-wait caden..." | Re-trigger Greptile

Comment thread bin/fm-watch.sh
Comment on lines +1007 to 1008
if [ -e "$STATE/.paused-$key" ] \
&& [ "$(age_of "$STATE/.paused-resurfaced-$key")" -lt "$PAUSE_RESURFACE_SECS" ]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Replacement waits inherit suppression

When a worker changes directly to a different paused: reason or captain-held decision key, the existing timestamp-only marker suppresses the new declaration because neither signal handling nor pause cleanup distinguishes its identity, causing the replacement obligation to remain hidden until the previous PAUSE_RESURFACE_SECS window expires.

Knowledge Base Used:

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is waiting on the author.

Reviewed body + bin/fm-watch.sh / test hunks vs main d3fcdfa548f5.

Security: clean. No .github/**. Author withally not blocked. Cross-repo fork.

Contract-class: restore. Declared-wait / pause cadence already exists; this stops status-append / pane-churn from re-arming stale wakes while the same declaration is held. Unconfigured run is meant to match the already-promised bounded pause behavior, not add a new always-on product path.

VISION:

  1. One captain, one interface — aligns (fewer false stale wakes).
  2. Authority explicit — aligns (no new autonomy grant).
  3. Scripts own mechanics — aligns (deterministic watcher).
  4. Restart non-event — aligns (cadence survives watcher restart).
  5. Delegation with a spine — aligns (honest supervision under load).
  6. Fleet outlives vendor — aligns (backend-agnostic watcher).
  7. Scope — aligns (command-layer watch, not forge).

Greptile FAILURE (P1): distinct replacement waits / changed pause reason or captain-held key can inherit an unrelated declaration's long suppression window after the one-shot live inspection + throttle change. Please address or rebut with a test before we treat this as merge-ready.

Attestation: MISSING on tip ff8eaba0e79b58be645e43ae45d522ea00e4014d — re-raise via no-mistakes.

Workflow approval this pass (tip action_required after diff review):

  • CI 33712437128
  • Require no-mistakes 33712437110

Land-eligible: NO until MATCH + green CI/NM + Greptile P1 cleared. Waiting on you, not the captain.

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.

2 participants