Skip to content

fix(omp): deliver session-start nudges on every /new session - #100

Merged
dnth merged 4 commits into
mainfrom
fm/fm-omp-new-nudge-omission
Sep 5, 2026
Merged

dnth merged 4 commits into
mainfrom
fm/fm-omp-new-nudge-omission

Conversation

@dnth

@dnth dnth commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

Intent

Fix: OMP /new omits the once-only session-start nudge on repeat. On OMP 18.1.5, running /new a second time omits the once-only session-start nudge (the FIRSTMATE_OP session-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.ts session_start/session_switch handling plus any nudge-sent marker/state). The nudge MUST fire on each /new session 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:

  • AC1: The /new-twice nudge omission is reproduced (a documented reproduction or a failing-before/passing-after test).
  • AC2: After the fix, the session-start nudge fires on each /new session replacement; the once-only guard no longer suppresses it incorrectly.
  • AC3: An ordinary single session start still delivers exactly one nudge (no regression, no double-nudge).
  • AC4: A regression test covers the /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

  • Updated the OMP primary adapter to append the session-start nudge to replacement-session context for native /new and /resume switches, clearing staged delivery to prevent duplicates.
  • Expanded in-process and live OMP regression coverage for consecutive /new sessions, ordinary startup, /resume, and silent /fork behavior.
  • Updated OMP session-start and supervision documentation with the new transport and OMP 18.1.5 verification evidence.

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 /new switches, 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
ok - OMP /new /resume /fork and reload session_switch paths auto-arm and carry an in-flight actionable close
ok - OMP unacknowledged wake delivery keeps the successor chain and delivers once per close
Evidence: Live OMP 18.1.5 end-to-end output
ok - OMP omp/18.1.5 primary E2E proved fresh no-state and ordinary native discovery, exact ownership, once-only startup, guarded watcher startup, repeated /new continuity, shutdown, resume, and away-mode delivery
ok - OMP omp/18.1.5 primary E2E proved watcher delivery with an intact editable draft

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.sh
  • FM_OMP_PRIMARY_LIVE_E2E=1 tests/fm-omp-primary-live-e2e.test.sh
  • tests/fm-sessionstart-nudge.test.sh
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

dnth added 4 commits September 5, 2026 01:10
…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
@dnth
dnth merged commit f2c8f30 into main Sep 5, 2026
16 checks passed
@dnth
dnth deleted the fm/fm-omp-new-nudge-omission branch September 5, 2026 00:28
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.

1 participant