fix: omp watcher stale replay handoff cleanup - #13
Merged
Merged
Conversation
…delivery Fixes the stale-replay and unbounded-growth bug in session-replacement-actionable.json. Changes: - Added loadAndFilterReplacementHandoff() that filters out handoff records whose backing task no longer exists (no state files, no queued wakes) and rewrites the handoff file. - Added isTaskAlive() and extractTaskId() helpers to determine if a task is still live by checking for state files (.meta, .status, .inbox, .progress, .turn-ended) and the durable wake queue. - Modified activateOwnedWatch() to use loadAndFilterReplacementHandoff() instead of loadReplacementHandoff(). - consumeWake() already calls finishPendingActionable() which clears the handoff record on first delivery at before_agent_start/message_start, preventing replay on the next session start. Tests: - test_watch_extension_drops_stale_replacement_records: verifies stale records for ghost tasks (no state files, no queued wakes) are dropped at load time, while valid records with state files are preserved. - test_watch_extension_consumption_clears_handoff: verifies the handoff is cleared after consumption at before_agent_start, and a subsequent actionable does not ride the replacement handoff.
rafaelreis-r
added a commit
that referenced
this pull request
Sep 19, 2026
… 2026-09-19, rule 2026-09-16) Resolves conflicts by taking upstream, plus one semantic reconciliation the auto-merge got wrong (captain-approved 2026-09-19): - AGENTS.md: add .dead-reported-* watcher internals file (PR kunchenguid#4775) - bin/fm-contributions.{jq,sh}: adopt upstream settle_final/final rename (PR kunchenguid#4710, kunchenguid#4661) - tests/fm-contributions.test.sh: align with upstream test reorganization - bin/fm-watch.sh: dead/missing endpoint now reports once via upstream wedge_dead_record (PR kunchenguid#4775); removed the fork-only retire_gone_window_records silent-retire subsystem (retire_gone_window_records, window_retired, prune_orphan_window_records, .retired-*) that shadowed it. Safer: warns to check unlanded work before cleanup. - tests/fm-watch-triage.test.sh: removed the fork tests for the retired subsystem All 9 fork PRs (#4..#13) preserved. No force push, no rebase.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the stale-replay bug where session-replacement-actionable.json accumulates records for closed panes/migrated tasks that are never consumed. Records whose backing file/pane no longer exists and queue is empty are now finalized and dropped. Consumption at message_start closes record on first delivery to prevent re-delivery.