Skip to content

feat(omp): add verified Firstmate harness adapter - #1

Merged
damianpdr merged 32 commits into
mainfrom
feat/omp-herdr
Jul 30, 2026
Merged

feat(omp): add verified Firstmate harness adapter#1
damianpdr merged 32 commits into
mainfrom
feat/omp-herdr

Conversation

@damianpdr

@damianpdr damianpdr commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Why

Firstmate can already transport and observe OMP sessions through Herdr, but upstream main does not contain a first-class OMP harness adapter. This ports the adapter work from kunchenguid#1144 onto current main and verifies it against OMP 17.2.0.

What

  • merge the OMP adapter and supervision integration from Boxyboxy PR Merge main into feat/omp-adaptor (omp adapter) - CI verification kunchenguid/firstmate#1144
  • preserve current-main Pi, Grok, lock, bootstrap, teardown, and Herdr behavior while resolving the stale branch conflicts
  • accept OMP 17.2's current ⟨esc⟩ busy token and the legacy ⟦esc⟧ token
  • recognize Bun-launched OMP process ancestry for harness detection and lock ownership
  • deliver the native reason-less OMP session_start nudge and explicit OMP identity to turn-end recovery
  • clear inherited harness markers at verified spawn boundaries without changing literal raw-launch commands
  • fail closed across OMP's complete worktree extension discovery surface, bind the trusted guard exception to the Firstmate Git lineage, and roll back rejected allocations
  • require verified, direct raw, quoted raw, and env-wrapped raw OMP secondmates to contain exactly the matching non-symlinked primary guard; ambiguous env split-string secondmate commands fail closed
  • keep raw non-OMP secondmate commands outside the OMP-only guard requirement
  • keep the tracked primary extension inert in linked task worktrees

Verification

  • initial focused OMP/lock/bootstrap/dispatch/turn-end/session-start suite: 14 scripts passed
  • final tests/fm-spawn-dispatch-profile.test.sh: passed, including JS/nested/package extension refusal, endpoint/worktree rollback, and raw non-OMP secondmate coverage
  • final tests/fm-omp-harness.test.sh: passed, including verified/direct/quoted/env-wrapped OMP guard refusal and env split-string fail-closed cases
  • final tests/fm-kimi-harness.test.sh: passed after inherited-marker launch expectations were updated
  • final tests/fm-sessionstart-nudge.test.sh: passed, including missing-state, initialized-primary, linked-worktree, native event, and OMP identity cases
  • final tests/fm-brief.test.sh, tests/fm-spawn-batch.test.sh, and tests/fm-turnend-guard.test.sh: passed
  • pinned ShellCheck 0.11.0: passed after final remediation
  • live isolated Herdr 0.7.5 / protocol 17 smoke with OMP 17.2.0: startup ran bin/fm-session-start.sh, .lock and .omp-turnend-extension-loaded were created, and Firstmate steering returned FIRSTMATE_FINAL_STEER
  • GitHub Actions run 30548774457: Herdr behavior, portable serial, both portable parallel lanes, timing aggregate, lint, stock macOS Bash, coverage guard, and repo invariants all passed
  • mandatory PR audit: final correctness, QA, and post-CI delta re-reviews clean; artifacts, comments, test value/determinism, and code slop passed

Provenance

Based on kunchenguid#1144 by @Boxyboxy; the merge commit retains the source branch history.

Merge policy

This is a personal-fork verification PR and remains draft. The repository's PR must be raised via no-mistakes policy check is expected to fail because this PR was created manually rather than by Firstmate's no-mistakes workflow; every substantive repository and Herdr CI gate passes. It is not being proposed for upstream merge.

Boxyboxy and others added 30 commits July 8, 2026 19:25
Add omp as a sixth verified harness adapter alongside claude, codex,
opencode, pi, and grok. omp is Pi-derived but distinct: it sets OMPCODE=1
(and CLAUDECODE=1, so detection must check OMPCODE first), runs as
process `omp`, needs --auto-approve for autonomy, uses --thinking for
effort, and exposes an active session_stop hook that forces a
continuation by returning {continue:true} - making omp a direct-blocking
turn-end harness (class with claude/codex).

- detection: fm-harness.sh prefers OMPCODE over CLAUDECODE, plus ancestry
- lock: fm-lock.sh HARNESS_RE recognizes ^omp$
- spawn: launch template (--auto-approve, -e turn-end signal ext),
  --model/--thinking flags (omit max), crewmate turn_end extension
- busy detection: the busy-only "esc" hint token in fm-watch.sh and
  fm-tmux-lib.sh (omp's Working... uses a unicode ellipsis)
- liveness: backends/tmux.sh classifies an omp pane as alive
- bootstrap: crew-dispatch verified()/effort_ok, secondmate-liveness set
- session-start: load-health check for the auto-discovered guard
- teardown: state/<id>.omp-ext.ts cleanup at both sites
- primary guard: tracked auto-discovered
  .omp/extensions/fm-primary-turnend-guard.ts (session_stop)
- supervision: docs/supervision-protocols/omp.md + repair_line arm
- knowledge: harness-adapters skill omp section + expanded new-adapter
  wiring checklist so future adapters are fully wired
- tests: new fm-omp-harness.test.sh + fm-lock.test.sh and coverage in
  bootstrap, teardown, turnend-guard, supervision, liveness; tests/lib.sh
  now clears ambient harness markers so detection is hermetic

Verified live on omp 16.3.12.
# Conflicts:
#	.agents/skills/harness-adapters/SKILL.md
#	README.md
#	bin/fm-spawn.sh
#	docs/turnend-guard.md
# Conflicts:
#	.agents/skills/harness-adapters/SKILL.md
#	AGENTS.md
#	README.md
#	docs/turnend-guard.md
#	tests/fm-teardown.test.sh
#	tests/lib.sh
Add omp as a sixth verified harness adapter alongside claude, codex,
opencode, pi, and grok. omp is Pi-derived but distinct: it sets OMPCODE=1
(and CLAUDECODE=1, so detection must check OMPCODE first), runs as
process `omp`, needs --auto-approve for autonomy, uses --thinking for
effort, and exposes an active session_stop hook that forces a
continuation by returning {continue:true} - making omp a direct-blocking
turn-end harness (class with claude/codex).

- detection: fm-harness.sh prefers OMPCODE over CLAUDECODE, plus ancestry
- lock: fm-lock.sh HARNESS_RE recognizes ^omp$
- spawn: launch template (--auto-approve, -e turn-end signal ext),
  --model/--thinking flags (omit max), crewmate turn_end extension
- busy detection: the busy-only "esc" hint token in fm-watch.sh and
  fm-tmux-lib.sh (omp's Working... uses a unicode ellipsis)
- liveness: backends/tmux.sh classifies an omp pane as alive
- bootstrap: crew-dispatch verified()/effort_ok, secondmate-liveness set
- session-start: load-health check for the auto-discovered guard
- teardown: state/<id>.omp-ext.ts cleanup at both sites
- primary guard: tracked auto-discovered
  .omp/extensions/fm-primary-turnend-guard.ts (session_stop)
- supervision: docs/supervision-protocols/omp.md + repair_line arm
- knowledge: harness-adapters skill omp section + expanded new-adapter
  wiring checklist so future adapters are fully wired
- tests: new fm-omp-harness.test.sh + fm-lock.test.sh and coverage in
  bootstrap, teardown, turnend-guard, supervision, liveness; tests/lib.sh
  now clears ambient harness markers so detection is hermetic

Verified live on omp 16.3.12.
… architecture guide

(cherry picked from commit ecdd6bb)
Combines the 24-commit omp (Oh My Pi) harness-adapter branch with the 50
newer commits on main. All 14 conflicts resolved additively: every omp
adapter surface is preserved and every main improvement is kept. omp
support is ported into structures main added after the branch diverged:
the fm-dispatch-select.sh verified-harness and effort tables, the
fm_backend_tmux_agent_state five-state recovery classifier, the
agent_state-based secondmate liveness sweep, the operational-input
launch-brief encoder in every omp launch template, and the reworked
fm-watch-arm successor contract in the omp supervision protocol.
… inside tmux)

Three pre-existing main failures surfaced by running the full suite on
macOS with system bash 3.2 from inside a tmux session; none were caused
by the omp merge:

- fm-brief.sh: assign the no-mistakes definition-of-done block with
  IFS= read -r -d '' instead of DOD=$(cat <<EOF ...). bash 3.2's
  command-substitution scanner cannot parse heredoc content holding an
  unbalanced quote character (the apostrophe in "firstmate's"), which
  made the whole script unparseable on macOS (kunchenguid#958).
- fm-spawn.sh: make a failed task-metadata publication explicitly fatal.
  bash 3.2 does not apply errexit to a redirection failure on a compound
  command, so an unwritable metadata path let the spawn report success.
- tests/fm-session-start.test.sh: clear TMUX for the tmux
  secondmate-recovery runner so the respawn under test resolves the
  static firstmate session instead of the host session the suite may be
  running inside.
Bring main's Kimi adapter, quota-aware agent-owned dispatch (drops
fm-dispatch-select.sh), Claude Stop asyncRewake auto-arm, shared
session-lock lib, per-harness tmux busy signatures, and the
guidance/verification doc split into the omp adapter branch.

Conflict resolution kept both sides: every verified-harness list now
carries kimi and omp; the omp and kimi adapter sections, launch cases,
teardown cleanup, and turn-end integrations coexist. omp's busy
signature moved into the per-harness FM_TMUX_OMP_BUSY_REGEX_DEFAULT and
its lock identity into fm-session-lock-lib.sh (FM_HARNESS_RE gains
^omp$).

Fixes exposed by the merge:
- fm-session-lock-lib.sh: match the command name and interpreter script
  basename separately instead of grepping the whole args string, so
  anchored short names (^pi$, ^omp$) resolve; restores pi/omp lock
  recognition that the lib refactor had regressed.
- fm-omp-harness.test.sh: assert omp's busy signature through the new
  per-harness matcher plus a behavioral fm_pane_is_busy check.
- docs/documentation-audiences.json: classify docs/supervision-protocols/omp.md.
…hine

- fm-session-start.test.sh: the concurrent-lock test used $BASHPID, which is
  unset on macOS system bash 3.2, so every acquirer got an empty harness pid
  and none won. Derive each subshell's own pid portably via
  $(exec sh -c 'echo $PPID').
- fm-spawn-batch.test.sh: run_spawn left FM_CONFIG_OVERRIDE='' so config
  resolved to the repo's own config/, letting a captain's live
  config/crew-dispatch.json trip the dispatch backstop. Point it at an
  isolated empty config dir so the hermetic test is independent of local files.
The merge moved omp's ⟦esc⟧ into the per-harness FM_TMUX_OMP_BUSY_REGEX_DEFAULT
only, but the harness-agnostic composer/submit path (fm_tmux_composer_row_state,
behind fm-send's submit acknowledgement and the away-mode composer read) uses
only FM_TMUX_BUSY_REGEX_DEFAULT. Without ⟦esc⟧ there, a steer to a busy omp pane
on the no-box fallback could false-report a swallowed Enter. ⟦esc⟧ is omp-unique
and unambiguous (unlike the claude/kimi spinners main deliberately scoped
per-harness), so it is safe in the shared default; restored in fm-tmux-lib.sh and
fm-watch.sh (kept byte-identical) and pinned by two omp-harness assertions.

Live smoke on omp 17.1.5 re-verified: SMOKE_OK print run, busy token ⟦esc⟧
present-busy/absent-idle, pane process name omp, launch flags, OMPCODE=1, and the
session_stop forced-continuation contract. Stamps updated accordingly.
@damianpdr
damianpdr marked this pull request as ready for review July 30, 2026 12:42
@cursor

cursor Bot commented Jul 30, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@damianpdr
damianpdr marked this pull request as draft July 30, 2026 14:06
@damianpdr
damianpdr marked this pull request as ready for review July 30, 2026 14:25
@damianpdr
damianpdr merged commit 2ecc509 into main Jul 30, 2026
9 of 11 checks passed
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.

2 participants