Honour a declared pause for a live worker, and archive finished-task clutter #14

Merged
john merged 1 commit from fm/parked-cadence-and-prune into main 2026-08-21 20:16:32 +00:00
Owner

Two causes of the same symptom: firstmate re-notifying about work that is finished and parked.

The cadence fix. The watcher never applied the long PAUSE_RESURFACE_SECS cadence to a worker whose agent was still alive. pause_state_class consulted liveness before the declaration, so an alive parked worker returned none on every pass and was re-surfaced every STALE_ESCALATE_SECS instead. Thirteen parked workers turned that into a continuous stream of notifications. An authoritative running pipeline still outranks the declaration, and a pane FIRST sighting still surfaces immediately, so a live external-decision gate is never hidden behind the long cadence.

The retention sweep. Nothing pruned data/<id>/ folders or state/ markers after teardown: 188 folders and 1391 state files had accumulated, nearly all for tasks torn down weeks earlier, and orphaned turn-end markers kept generating wakes for tasks that no longer exist. bin/fm-prune-state.sh archives them - it never deletes, never touches a task that still has metadata, and never touches the durable home records.

Both regressions were proven red. With the cadence fix removed the new test surfaces the parked pane; with the sweep neutered its test finds the report unarchived.

Verified locally: full tests/fm-watch-triage.test.sh suite passes, tests/fm-prune-state.test.sh passes, shellcheck clean. Observed in production for two hours before this PR: 45 minutes of silence followed by correctly-labelled hourly rechecks, replacing a notification every four minutes.

Two causes of the same symptom: firstmate re-notifying about work that is finished and parked. **The cadence fix.** The watcher never applied the long `PAUSE_RESURFACE_SECS` cadence to a worker whose agent was still alive. `pause_state_class` consulted liveness before the declaration, so an alive parked worker returned `none` on every pass and was re-surfaced every `STALE_ESCALATE_SECS` instead. Thirteen parked workers turned that into a continuous stream of notifications. An authoritative running pipeline still outranks the declaration, and a pane FIRST sighting still surfaces immediately, so a live external-decision gate is never hidden behind the long cadence. **The retention sweep.** Nothing pruned `data/<id>/` folders or `state/` markers after teardown: 188 folders and 1391 state files had accumulated, nearly all for tasks torn down weeks earlier, and orphaned turn-end markers kept generating wakes for tasks that no longer exist. `bin/fm-prune-state.sh` archives them - it never deletes, never touches a task that still has metadata, and never touches the durable home records. **Both regressions were proven red.** With the cadence fix removed the new test surfaces the parked pane; with the sweep neutered its test finds the report unarchived. Verified locally: full `tests/fm-watch-triage.test.sh` suite passes, `tests/fm-prune-state.test.sh` passes, shellcheck clean. Observed in production for two hours before this PR: 45 minutes of silence followed by correctly-labelled hourly rechecks, replacing a notification every four minutes.
fix(watch): honour a declared pause for a live worker, and archive finished-task clutter
All checks were successful
CI / Test coverage guard (pull_request) Successful in 12s
CI / Behavior portable parallel 2 (pull_request) Successful in 2m57s
CI / Behavior portable parallel 1 (pull_request) Successful in 3m2s
CI / Lint shell scripts (pull_request) Successful in 4m25s
CI / Behavior portable serial 4 (pull_request) Successful in 9m16s
CI / Behavior portable serial 3 (pull_request) Successful in 11m33s
CI / Repo invariants (pull_request) Successful in 4s
CI / Behavior portable serial 2 (pull_request) Successful in 12m17s
CI / Behavior portable serial 1 (pull_request) Successful in 17m21s
CI / Behavior tests (Herdr) (pull_request) Successful in 7m40s
c6ffb8dc49
Two causes of the same symptom: firstmate re-notifying about work that is
finished and parked.

The watcher never applied the long PAUSE_RESURFACE_SECS cadence to a worker
whose agent was still alive. `pause_state_class` consulted liveness before the
declaration, so an alive parked worker returned `none` on every pass and was
re-surfaced every STALE_ESCALATE_SECS instead. Thirteen parked workers turned
that into a continuous stream of notifications. An authoritative running
pipeline still outranks the declaration, and a pane's FIRST sighting still
surfaces immediately, so a live external-decision gate is never hidden behind
the long cadence.

Nothing pruned `data/<id>/` folders or `state/` markers after teardown either:
188 folders and 1391 state files had accumulated, nearly all for tasks torn down
weeks earlier, and orphaned turn-end markers kept generating wakes for tasks
that no longer exist. `bin/fm-prune-state.sh` archives them - it never deletes,
never touches a task that still has metadata, and never touches the durable home
records.

Both regressions fail red without their fix: the cadence test surfaces the
parked pane, and the sweep test finds the report unarchived.
john merged commit 8c2056d4fa into main 2026-08-21 20:16:32 +00:00
john deleted branch fm/parked-cadence-and-prune 2026-08-21 20:16:32 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
john/firstmate!14
No description provided.