Skip to content

fix: recognize the bun-installed omp as a harness process - #8350

Merged
kunchenguid merged 6 commits into
kunchenguid:mainfrom
fmaggi-cw:fm/fm-omp-bun-identity-pr
Nov 12, 2026
Merged

kunchenguid merged 6 commits into
kunchenguid:mainfrom
fmaggi-cw:fm/fm-omp-bun-identity-pr

Conversation

@fmaggi-cw

@fmaggi-cw fmaggi-cw commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Intent

for your modification of firstmate: see and act on this review #8350 (comment)

The modification is PR #8350, "fix: recognize the bun-installed omp as a harness process", opened from the fork branch fmaggi-cw/firstmate:fm/fm-omp-bun-identity-pr (head b29e4db). It adds bin/fm-omp-process-lib.sh with fm_omp_process_matches, used by the session-lock ancestry walk (bin/fm-session-lock-lib.sh) and harness detection (bin/fm-harness.sh), so an omp installed as the bun global package (process bun <path>/omp) is recognized and owns its session lock.

The review asks for three things:

  1. Greptile P1 "Spaced install paths still fail" (bin/fm-omp-process-lib.sh:24): read -r -a splits the printed ps args on whitespace, so bun /opt/Agent Tools/bin/omp is checked as /opt/Agent and refused, and both detection and the session-lock walk miss a bun-run omp on that install path. Handle a script path that contains spaces, with a regression for it.
  2. Greptile P2 "Live guard misses wrong owner" (tests/fm-omp-primary-live-e2e.test.sh:78): the new probe checks that fm-lock.sh succeeds but never checks which process owns the lock, so if the lock matcher stopped recognizing the bun process the walk could reach an outer Claude session and still pass. Record the extension process.pid and compare it with the saved lock before reporting success.
  3. No-mistakes attestation: the PR body has none, so the "PR must be raised via no-mistakes" check fails. Re-raise the PR with one clean git push no-mistakes from the fork branch, so the attestation binds the head with no skipped steps.

What Changed

  • Added bin/fm-omp-process-lib.sh with fm_omp_process_matches. It matches the compiled omp binary by exact process name, and also matches the bun global package, where ps reports bun <path>/omp. Because ps joins argv with spaces, the function rebuilds a script path containing spaces (such as bun /opt/Agent Tools/bin/omp) by extending the word until it names an existing file. bin/fm-harness.sh (marker check and ancestry verdict) and the session-lock walk in bin/fm-session-lock-lib.sh both use it, so a bun-run omp is detected as omp and owns its session lock. ompd, comp, and other scripts followed by an omp argument still don't match.
  • tests/fm-omp-harness.test.sh and tests/fm-session-lock-ancestry.test.sh add cases for the bun shape, including a spaced install path. tests/fm-omp-primary-live-e2e.test.sh adds a token-free default-on probe: it starts the installed omp in RPC mode with an extension that runs fm-harness.sh and fm-lock.sh, and passes only when the saved lock names that omp process's pid. Test fixtures that source the session-lock library now also copy the new lib.
  • Updated the omp harness adapter reference, SKILL.md, and docs/verification/runtime-backends.md to describe the two process shapes, the lock-owner check, and the live run against omp 18.12.3 (bun package, macOS).

Risk Assessment

✅ Low: The matcher is narrowed to the verified shapes (comm omp, or bun followed directly by a script named omp). I traced spaced install paths, decoy names, and an existing script followed by an omp argument through it and each gives the right result. The live guard now compares the lock owner with the extension's process.pid, and every fixture that sources the session-lock library also copies the new lib.

Testing

I ran the live token-free omp identity probe against the real bun-installed omp twice: once at its normal install path and once symlinked under a path with a space in it. Both runs detected omp and saved the session lock under the omp process's own pid. Two mutation runs in throwaway copies confirmed the guards work. Without the spaced-path rebuild, omp is misdetected as claude. Without the lock-walk match, the lock goes to the outer claude pid and the new owner check rejects it. The targeted omp harness and session-lock ancestry suites finished with no failures in their output. All temp labs and mutation copies were deleted, and the worktree is clean.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Bun-installed omp (process bun ~/.bun/bin/omp) is detected as omp and owns its session lock ✅ pass live s1-installed-bun-omp-identity.txt
Bun-run omp on an install path with a space (bun …/Agent Tools/bin/omp) is detected as omp and owns the lock ✅ pass live s2-spaced-install-path-identity.txt
Adversarial: without the spaced-path rebuild, the spaced install is refused (shows the regression is real) ✅ pass live s3-s4-mutation-guards.txt (Mutation A)
Adversarial: if the lock walk stops recognizing bun omp, the live guard fails instead of passing on an outer Claude lock ✅ pass live s3-s4-mutation-guards.txt (Mutation B)
Evidence: Installed bun-package omp identity probe

Source: Installed bun-package omp identity probe

ok - omp omp/18.12.3 (bun-package): detected as omp and acquired the session lock with no model tokens

$ ls -l $(command -v omp)
lrwxrwxrwx@ 1 fmaggi  staff  68 Oct 19 17:46 ~/.bun/bin/omp -> ../install/global/node_modules/@oh-my-pi/pi-coding-agent/dist/cli.js
$ bash tests/fm-omp-primary-live-e2e.test.sh
ok - omp omp/18.12.3 (bun-package): detected as omp and acquired the session lock with no model tokens
exit=0
Evidence: Spaced install path identity probe with live ps

Source: Spaced install path identity probe with live ps

ok - omp omp/18.12.3 (bun-package): detected as omp and acquired the session lock 90256 bun bun /var/folders/.../fm-omp-sp.N1qi6z/Agent Tools/bin/omp --version

$ PATH="/var/folders/rf/0k9kxrnd1qgcmwt_b_cv2gg80000gp/T//fm-omp-sp.N1qi6z/Agent Tools/bin:$PATH" bash tests/fm-omp-primary-live-e2e.test.sh
ok - omp omp/18.12.3 (bun-package): detected as omp and acquired the session lock with no model tokens
exit=0
# live ps of the bun-run omp during the probe (pid comm args):
90256 bun              bun /var/folders/rf/0k9kxrnd1qgcmwt_b_cv2gg80000gp/T//fm-omp-sp.N1qi6z/Agent Tools/bin/omp --version
Evidence: Mutation guards (spaced-path and wrong lock owner)

Source: Mutation guards (spaced-path and wrong lock owner)

A: not ok - omp omp/18.12.3 (bun-package) was detected as claude, not omp B: not ok - omp omp/18.12.3 (bun-package) acquired the session lock for pid 49055, not the omp process 17094 49055 claude

## Mutation A: spaced-path rebuild removed from fm_omp_process_matches
--- bin/fm-omp-process-lib.sh	2026-11-11 20:12:18
+++ /var/folders/rf/0k9kxrnd1qgcmwt_b_cv2gg80000gp/T//fm-mutA.0ru2jn/bin/fm-omp-process-lib.sh	2026-11-11 20:17:59
@@ -27,10 +27,5 @@
   n=${#words[@]}
   [ "$n" -ge 2 ] && [ "${words[0]##*/}" = bun ] || return 1
   script=${words[1]}
-  for ((i = 2; i < n; i++)); do
-    [ -f "$script" ] && break
-    script+=" ${words[i]}"
-  done
-  [ -f "$script" ] || script=${words[1]}
   [ "${script##*/}" = omp ]
 }
$ PATH="<tmp>/Agent Tools/bin:$PATH" bash tests/fm-omp-primary-live-e2e.test.sh   (mutated copy)
not ok - omp omp/18.12.3 (bun-package) was detected as claude, not omp
exit=1

## Mutation B: session-lock walk no longer recognizes omp (detection still does)
--- bin/fm-session-lock-lib.sh	2026-11-11 20:12:18
+++ /var/folders/rf/0k9kxrnd1qgcmwt_b_cv2gg80000gp/T//fm-mutB.nv5fFf/bin/fm-session-lock-lib.sh	2026-11-11 20:17:59
@@ -138,7 +138,6 @@
   # locate its own harness in the ancestry, so every session start refuses the
   # fleet lock as read-only and the park can never arm.
   fm_cursor_process_matches "$comm" "$args" "$argv0" && return 0
-  fm_omp_process_matches "$comm" "$args" && return 0
   return 1
 }
 
$ bash tests/fm-omp-primary-live-e2e.test.sh   (mutated copy, installed ~/.bun/bin/omp)
not ok - omp omp/18.12.3 (bun-package) acquired the session lock for pid 49055, not the omp process 17094
exit=1
49055 claude
Evidence: Targeted regression suites

Source: Targeted regression suites

$ bash tests/fm-omp-harness.test.sh
ok - .omp watch extension: an opted-in home runs the supervision host and relays every host line (quiet record)
ok - .omp watch extension: a home without config/supervision-host or with an off file keeps the plain arm
ok - .omp watch extension: a host-only boundary rides the replacement handoff and replays in the successor session
ok - .omp watch extension: a host close split across stream chunks reaches main as one whole follow-up
exit=
$ bash tests/fm-session-lock-ancestry.test.sh
ok - session-lock: a failed lock write removes a newly created sidecar
ok - session-lock: a verified reclaim keeps the new sidecar beside the new pid
ok - session-lock: a re-anchor keeps both supervision actors' task leases live
ok - session-lock: a re-anchor during a rewake turn keeps the mid-turn auto-arm proof healthy
exit=

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.

  • Live validation: ✅ go - 4 of 4 scenarios driven live against the product
Scenario Result Live Evidence
Bun-installed omp (process bun ~/.bun/bin/omp) is detected as omp and owns its session lock ✅ pass live s1-installed-bun-omp-identity.txt
Bun-run omp on an install path with a space (bun …/Agent Tools/bin/omp) is detected as omp and owns the lock ✅ pass live s2-spaced-install-path-identity.txt
Adversarial: without the spaced-path rebuild, the spaced install is refused (shows the regression is real) ✅ pass live s3-s4-mutation-guards.txt (Mutation A)
Adversarial: if the lock walk stops recognizing bun omp, the live guard fails instead of passing on an outer Claude lock ✅ pass live s3-s4-mutation-guards.txt (Mutation B)
  • bash tests/fm-omp-primary-live-e2e.test.sh against the installed bun-package omp (~/.bun/bin/omp)
  • PATH=&#34;$TMP/Agent Tools/bin:$PATH&#34; bash tests/fm-omp-primary-live-e2e.test.sh with omp symlinked under a directory whose name contains a space, plus a live ps -axo pid=,comm=,args= capture of the bun &lt;path with space&gt;/omp launch shape
  • Mutation A (throwaway git archive copy): removed the spaced-path rebuild loop from fm_omp_process_matches, re-ran the spaced-path probe, and it failed as expected
  • Mutation B (throwaway copy): removed the fm_omp_process_matches call from the session-lock matcher, re-ran the probe, and the wrong-owner check failed as expected (lock went to the outer claude pid 49055)
  • bash tests/fm-omp-harness.test.sh (no failures in output)
  • bash tests/fm-session-lock-ancestry.test.sh (no failures in output, exit 0)
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @fmaggi-cw. I read the full diff against main 913bb7a7 and approved this fork's CI and no-mistakes runs on b29e4dba, so you get CI signal while it's a draft.

Status: waiting on you. It's a draft, so it isn't in the merge queue yet. When it's ready, please raise it through no-mistakes with git push no-mistakes, so the PR body carries the attestation for the current head with no skipped steps. That check is required here, and the current body has none. Marking it ready for review then puts it back in triage.

What I checked (looks right): fm_omp_process_matches uses only bun's first non-option argument. It refuses -e, --eval, -p, --print, ompd, comp, and other packages' cli.js, and the compiled omp path still sits above the interpreter fallback as before. Main already records the Bun package install (~/.bun/bin/omp, omp 18.4.3) as verified in docs/verification/runtime-backends.md. So a primary on that install shape refusing the session lock is a regression of a verified harness, not a new one. The new token-free live half only runs where omp is installed. Your follow-up note about the pane-liveness classifier (bin/fm-agent-process-lib.sh) reading a bun-run omp worker as unrecognized is worth its own issue.

VISION (per rule): One captain: aligns (the session no longer stays read-only without saying why). Authority explicit: aligns. Scripts own mechanics: aligns (exact process identity). Restart non-event: aligns. Delegation: aligns. Fleet outlives vendor: aligns (adapter verification for an install main already lists). Scope: aligns.

Contract-class: restore.

@fmaggi-cw
fmaggi-cw marked this pull request as ready for review November 10, 2026 23:29
@greptile-apps

greptile-apps Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] No new blocking issue was found beyond the existing review threads.

Reviews (3) · Last reviewed commit: "no-mistakes(document): Note omp live gua..." · Reviewed by Greptile

Comment thread bin/fm-omp-process-lib.sh Resolved
Comment thread tests/fm-omp-primary-live-e2e.test.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @fmaggi-cw for marking this ready. I re-read the full diff at b29e4dba against main 1d43f9cb (1 behind, no conflict).

This waits on you for two things:

  1. Greptile P1 "Spaced install paths still fail" (thread at bin/fm-omp-process-lib.sh:24, unresolved). read -r -a splits the printed ps args on whitespace. So bun /opt/Agent Tools/bin/omp is checked as /opt/Agent and refused, and both detection and the session-lock walk miss the bun-run omp on that install path. Please handle a script path that contains spaces, with a regression for it, or reply on the thread if you think it's out of scope. The P2 on the same review (thread: the live guard doesn't check which process owns the lock) is worth taking in the same pass.
  2. No-mistakes attestation. The body still has none, so PR must be raised via no-mistakes fails (run 42908298256: "This PR was not raised through no-mistakes"). Please do one clean git push no-mistakes re-raise from your fork branch, so the attestation binds the head with no skipped steps.

My read is unchanged on the rest. Contract-class: restore. Main already records the Bun package install (~/.bun/bin/omp) as verified, and this makes that shape detect and own its lock again. Coverage guard and repo invariants pass. The "Full suite" check without the label isn't something you need to act on.

@fmaggi-cw
fmaggi-cw force-pushed the fm/fm-omp-bun-identity-pr branch from b29e4db to c76d456 Compare November 11, 2026 20:55
@kunchenguid kunchenguid added the full-ci Maintainer go-ahead: run the full CI suite on this outside pull request label Nov 11, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @fmaggi-cw. That settles all three things I asked for. I read the full diff at c76d456f against latest main 47df77f3 and approved the fork CI and no-mistakes runs on this head.

  • Spaced install paths (Greptile P1): fm_omp_process_matches now rebuilds a space-split script path word by word until it names an existing file. It still requires bun as argv0 and a script named exactly omp. Your live probe from a .../Agent Tools/bin/omp symlink detects omp and owns the lock, and mutation A shows the old first-word matching fails it. The thread is resolved.
  • Live guard owner (P2): the probe now compares the saved lock pid with the omp extension's process.pid, and mutation B shows it rejects a lock held by the outer Claude session. The thread is resolved.
  • No-mistakes: the attestation binds c76d456f with no skipped steps, and the check passes. The coverage guard and repo invariants pass, and Greptile is 5/5 with no open threads.

The full suite is queued now; nothing is needed from you while it runs.

contract-class: restore. main's docs/verification/runtime-backends.md already records the Bun package install (~/.bun/bin/omp) as verified. This makes that install detect as omp and own its session lock again, and the compiled-binary path is unchanged.

VISION: One captain aligns (the session no longer stays read-only without saying why) · Authority aligns · Scripts aligns (exact process identity) · Restart aligns · Delegation aligns · Vendor aligns (adapter verification for an install main already lists) · Scope aligns.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @fmaggi-cw. The labelled full suite ran on c76d456f and three lanes fail, all for the same reason in this PR's own change.

This waits on you for one fix. bin/fm-session-lock-lib.sh now sources the new bin/fm-omp-process-lib.sh, but several suites build a fixture home by copying a fixed list of bin/ libraries, and they don't copy the new one. The source fails and its stderr leaks into hook output that those tests require to be empty:

  • Behavior portable serial 6 (job): tests/fm-cursor-primary.test.sh: not ok - the run wrapper emitted a digest for the Cursor duplicate: …/host-sessionstart/bin/fm-session-lock-lib.sh: line 29: …/bin/fm-omp-process-lib.sh: No such file or directory
  • Behavior portable serial 4 (job): tests/fm-claude-stop-autoarm.test.sh: not ok - repeated hook duplicated the delivered actionable result: …/bin/fm-session-lock-lib.sh: line 29: …/bin/fm-omp-process-lib.sh: No such file or directory
  • Behavior portable serial 11 (job): tests/fm-turnend-guard.test.sh: not ok - --claude owner-claimed allow produced output: …/bin/fm-session-lock-lib.sh: line 29: …/bin/fm-omp-process-lib.sh: No such file or directory

These fixtures already copy fm-session-lock-lib.sh (and fm-turnend-guard.test.sh copies fm-hermes-process-lib.sh the same way), so adding fm-omp-process-lib.sh next to it in each one should do it. Please also check the other suites that copy fm-session-lock-lib.sh or fm-harness.sh into a fixture. The same shards pass on main and on other PRs this window, so this isn't a flake. Please push the fix through one clean git push no-mistakes. The full-ci label stays on, so the full suite reruns on your new head.

Everything else still holds: no-mistakes binds c76d456f with no skipped steps, the coverage guard and repo invariants pass, and Greptile is 5/5 with no open threads.

contract-class: restore, unchanged. main's docs/verification/runtime-backends.md already lists the Bun install (~/.bun/bin/omp) as verified.

The bun global package runs omp as `bun <path>/omp`, so ps reports the
process name `bun` and the lock ancestry walk and primary detection, which
matched only the exact name `omp`, refused the session lock and printed
unknown.

bin/fm-omp-process-lib.sh now owns omp identity: the exact name `omp`, or
bun whose first non-option argument is a script named `omp` or the
package's dist/cli.js. Both call sites use it. Regressions drive real
processes through fm-harness.sh and fm-lock.sh, and the omp live guard gains
a token-free installed-omp identity probe.
The ps args fallback split the script path on whitespace, so a path like /opt/Agent Tools/bin/omp was judged as /opt/Agent. Rebuild the first non-option word until it names an existing file. The token-free live guard now also asserts the saved session lock names the omp process.
Match only comm omp, or bun whose argv0 is bun and whose next argument
is a script named exactly omp. Drop the dist/cli.js path, the bun option
skip with its eval/print exclusion, and the argv0-omp-under-bun branch,
with their tests and doc mentions. Spaced install paths still resolve.
@fmaggi-cw
fmaggi-cw force-pushed the fm/fm-omp-bun-identity-pr branch from c76d456 to 5cae1d2 Compare November 12, 2026 04:38
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @fmaggi-cw, that's the fix I asked for. On 5cae1d22 (rebased onto main a02b0898), fm-omp-process-lib.sh is now copied or linked next to fm-session-lock-lib.sh in every fixture home that builds its own bin/. That covers the three failing suites (fm-cursor-primary, fm-claude-stop-autoarm, fm-turnend-guard) plus fm-afk-return, fm-agy-primary, fm-gotmp, fm-session-lock-ancestry and the two live hook suites. The other tests that mention the session-lock library source it straight from the repo, so I don't see one missed. I re-read the full diff and approved the fork CI and no-mistakes runs on this head. The full-ci label is still on, so the full suite is running again now.

The no-mistakes attestation binds this head with no skipped steps, Greptile is 5/5 with both threads resolved, and the branch is current with main. contract-class: restore, unchanged. Nothing is needed from you while it runs.

@kunchenguid
kunchenguid merged commit 09ca015 into kunchenguid:main Nov 12, 2026
24 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @fmaggi-cw — really appreciate you taking the time on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Maintainer go-ahead: run the full CI suite on this outside pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants