fix(omp): deliver session-start nudges on every /new session - #100
Merged
Merged
Conversation
…witches A native /new or /resume replaces the conversation while this process still owns the lock, so the extension re-arms the watcher at once and its first wake starts an agent-initiated turn. OMP 18.1.5 never emits before_agent_start for that turn, nor for a captain prompt queued into it, so the nudge staged for before_agent_start stayed parked and every /new session started without it. Append the typed instruction to the replacement session's context through sendMessage at switch time instead, and stage nothing for before_agent_start so it cannot be delivered twice. Ordinary session_start keeps its once-only before_agent_start binding to the launch prompt. The in-process regression now drives /new twice with no before_agent_start in between, /resume, and a silent /fork; the live guard drives two consecutive /new switches and requires each instruction to precede the new session's first assistant record. Verification records the OMP 18.1.5 pass and the pre-fix failure's cause. Claude-Session: https://claude.ai/code/session_018fL1BK5HE5upWiAabedFaK
…nmatched parentheses from the new heredoc JavaScript comment in tests/fm-omp-primary.test.sh. Verified with /bin/bash -n, the OMP primary test suite (13 passing cases), and bin/fm-lint.sh
… by removing an apostrophe from a JavaScript heredoc comment in tests/fm-omp-primary.test.sh. Verified with Bash 3.2 syntax parsing, the full OMP primary test (13/13 passing), Bash syntax check, ShellCheck, and git diff validation
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: OMP
/newomits the once-only session-start nudge on repeat. On OMP 18.1.5, running/newa second time omits the once-only session-start nudge (theFIRSTMATE_OPsession-start injection); this was surfaced and reproduced identically during the kunchenguid#3498 watcher-continuity port. Investigate the OMP primary adapter's session-start nudge delivery and its once-only guard (.omp/extensions/fm-primary-omp.tssession_start/session_switchhandling plus any nudge-sent marker/state). The nudge MUST fire on each/newsession replacement; a stale once-only guard must not suppress it. This is firstmate shared tracked material (.omp/extensions/,bin/, tests, docs) and follows the firstmate-coding-guidelines skill. Reproduce the bug first, fix it minimally, and preserve correct single-fire behavior on an ordinary first session start (do not double-nudge).Acceptance criteria:
/new-twice nudge omission is reproduced (a documented reproduction or a failing-before/passing-after test)./newsession replacement; the once-only guard no longer suppresses it incorrectly./new-twice case, and the relevant OMP primary/session-start tests plus shellcheck pass.Decisions made while implementing: the live reproduction showed the omission affects every native /new (not only the second), because after /new the process still owns the session lock, the extension re-arms the watcher immediately, and the watcher's first wake starts an agent-initiated turn via sendMessage(triggerTurn) for which OMP never emits before_agent_start (nor for a captain prompt queued into that turn), so a nudge staged for before_agent_start stays parked. The fix appends the typed session-start instruction to the replacement session's context via omp.sendMessage({customType: firstmate-sessionstart-nudge, display: false, attribution: agent}, {deliverAs: "nextTurn"}) at session_switch time for reasons "new" and "resume", and clears the staged pending nudge so before_agent_start cannot deliver it a second time. Ordinary session_start deliberately keeps the before_agent_start binding to the launch prompt (once-only, no watcher armed yet at process start). /fork and reload switches deliberately still run the wrapper, which stays silent while this process holds the lock. The in-process regression in tests/fm-omp-primary.test.sh drives /new, a second /new with no before_agent_start in between, /resume, and a silent /fork, and fails against the pre-fix adapter (8 of 13 cases) and passes after (13 of 13). The opt-in live guard tests/fm-omp-primary-live-e2e.test.sh now drives two consecutive /new switches and requires each new session's nudge entry to precede its first assistant record; it passed against installed OMP 18.1.5 and that dated result replaces the prior "intentionally red" note in docs/verification/supervision.md. docs/sessionstart-nudge.md and docs/supervision-protocols/omp.md describe the new OMP switch transport. bin/fm-lint.sh and bin/fm-doc-audience-check.sh pass.
Firstmate-Validation-Generation: 284a367c4a91a84a4d86a24a70125e68
What Changed
/newand/resumeswitches, clearing staged delivery to prevent duplicates./newsessions, ordinary startup,/resume, and silent/forkbehavior.Risk Assessment
✅ Low: The change is narrowly scoped to OMP native session replacement nudge delivery, preserves ordinary startup behavior, and adds behavioral regression coverage and updated verification evidence.
Testing
Exercised the focused OMP primary regression suite, the installed OMP 18.1.5 live lifecycle with two consecutive
/newswitches, and session-start nudge tests. The regression confirms each replacement receives one nudge while ordinary startup remains single-fire; live E2E completed successfully. No source or transient worktree artifacts were created.Evidence: OMP primary regression output
Evidence: Live OMP 18.1.5 end-to-end output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
timeout 120 tests/fm-omp-primary.test.shFM_OMP_PRIMARY_LIVE_E2E=1 tests/fm-omp-primary-live-e2e.test.shtests/fm-sessionstart-nudge.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.