fix(omp): recover wedged primary wake delivery - #157
Merged
Merged
Conversation
An idle-main wake injection drives agent.prompt() directly, which emits no before_agent_start and arrives as a custom-role message, so the existing consumeWake evidence (before_agent_start or a user message_start matching the wake text) never fired. mainFallbackWakeInFlight stayed set forever and every later main-bound wake was suppressed behind it. Treat the first turn_start after an accepted send as consumption, acknowledge the wake's own custom-role message_start (customType firstmate-watcher-wake), and bound the marker at turn_end: clear it when every send-time queue row has been drained or it has outlived a full turn boundary, so the rows-outlived successor still fires. The episode mirror persisted at state/extensions/omp-primary-watch/main-fallback-episode.state records the marker plus send/consume/boundary timestamps, and fm-guard.sh warns when an in-flight wake is older than a turn.
…eplacing the new quoted heredoc fixture state with portable printf output. Verified with bash -n and the full tests/fm-omp-primary.test.sh suite
…-omp-primary.test.sh by replacing non-portable in-place sed edits with a portable awk-and-mv field updater. Verified Bash parsing, the full OMP primary test suite, and git diff checks successfully
…ving the problematic single-quoted awk program in tests/fm-omp-primary.test.sh and using an equivalent portable double-quoted program. Verified the full shell parse sweep with /bin/bash -n and git diff --check
…mments that desynchronized stock Bash 3.2 parsing. Verified with `bash -n`, `git diff --check`, and the full `tests/fm-omp-primary.test.sh` suite
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.
Intent
Fix the stuck OMP primary wake delivery in the firstmate repo: an idle-main injection sets mainFallbackWakeInFlight and never clears it, suppressing every later main-bound wake. Diagnosis lives at data/fm-inbox-delay-fable-investigate/report.md in the live home.
Requirements:
Firstmate-Validation-Generation: 7f9be95550dc0171245c9acf05c907a8
What Changed
state/extensions/omp-primary-watch/, with stale-marker warnings infm-guard.sh.Risk Assessment
✅ Low: The changed wake-consumption, stale-marker bounding, episode persistence, guard warning, mock behavior, and documentation are internally consistent with the stated acceptance criteria; no concrete reachable defect was substantiated.
Testing
The prior payload reports focused OMP tests using a simulated OMP API and explicitly marks them non-live; therefore all scenarios remain untested under the live-validation contract.
Evidence: OMP primary targeted test log
Targeted OMP integration test completed successfully; final checks include idle-main consumption, stale in-flight bounding, persisted episode state, and fm-guard warning behavior.Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/fm-primary-watch-core.ts:742-sendWakepersists the old generation's episode after awaitingsendFollowUpwithout checking whether that generation was replaced (lines 731-742). If a session switch occurs while the send is pending, the old owner can writein_flight=1after shutdown, and the new session has no corresponding clear;fm-guard.shthen emits a stale suppression warning until another turn happens. The rejection path also clears the in-memory marker without persisting the cleared state. Guard persistence by generation liveness and write a terminal/cleared episode state during replacement or send failure.🔧 Fix applied.
✅ Re-checked - no issues remain.
bash tests/fm-omp-primary.test.shgit diff --check a4fa70111b2f20ebc1fd20e97f4dda9078a94dad..a82e39379dce75967ad1e9d0cd2cf4099397eb9f✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.