Skip to content

fix(bin): point non-checkout omp homes at fm <project> relaunch - #7155

Merged
kunchenguid merged 2 commits into
kunchenguid:mainfrom
avivl:avivl/omp-restart-hint-upstream-pr
Oct 21, 2026
Merged

kunchenguid merged 2 commits into
kunchenguid:mainfrom
avivl:avivl/omp-restart-hint-upstream-pr

Conversation

@avivl

@avivl avivl commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Intent

Upstream pull request #7155 (fork branch avivl/omp-restart-hint-upstream-pr on [email protected]:avivl/firstmate.git, current head 8c24451642953372d7524d71e7303c4e3d99814b) fixes firstmate's omp guidance. In a home other than the firstmate checkout, firstmate sessions were told to "restart omp inside this home", which does not work: omp's watcher and turn-end extensions load from the checkout's .omp/extensions/ and pick their home from the FM_HOME environment variable at launch (.omp/extensions/fm-primary-omp-watch.ts:139), and a bare omp or a /resume from the firstmate folder starts without FM_HOME, so the extension attaches to the checkout's own home and the arm tool is refused. The fix changes the guidance in bin/fm-supervision-instructions.sh, bin/fm-session-start.sh and docs/supervision-protocols/omp.md to say, for a home that is not the checkout, to exit omp and relaunch through fm <project> (the launcher sets FM_HOME and --cwd), and adds a warning-only OMP_WATCH_CAUSE line to session start when the extension marker names a pid that is not the current session. When the home is the checkout itself the old wording is unchanged. The upstream owner's reviewer asked for two things: live evidence on a real omp, and a rebase because the branch is 22 commits behind main. The captain posted the live evidence (real omp 18.10.2, five scenarios, all passing on the PR head and on a clean scratch rebase onto main) as a comment, and approved this one upstream push with the words: approve the upstream push for pr://7155. The remaining work is to rebase the branch onto current origin/main and re-raise it through the no-mistakes pipeline once.

What Changed

  • bin/fm-supervision-instructions.sh, bin/fm-session-start.sh and docs/supervision-protocols/omp.md: when the home is not the firstmate checkout, the omp guidance now says to exit omp and relaunch through fm <project>, instead of "restart omp inside this home". The extension takes its home from FM_HOME at launch, and the fm launcher sets it. When the home is the checkout itself, the wording is unchanged.
  • bin/fm-session-start.sh: session start emits a warning-only OMP_WATCH_CAUSE line when the extension marker names a pid that is not the current session.
  • tests/fm-session-start.test.sh and tests/fm-supervision-instructions.test.sh: new cases covering the changed guidance and the new OMP_WATCH_CAUSE line.

Risk Assessment

✅ Low: The change only alters diagnostic and guidance text, gated on whether the home is the checkout, and the one source consumer of the omp doc substitutes the new placeholders. The recorded round-1 decision (drop the unset-FM_HOME cause) is applied and the marker-pid cause stays warning-only.

Testing

I rendered the omp supervision protocol and repair line for a non-checkout home and for the checkout home. I also ran the supervision-instructions test file and the session-start tests, which run the real session-start script. All passed. I did not run a real omp primary here; the captain's posted omp 18.10.2 evidence covers that.

  • Live validation: ✅ go - 4 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Non-checkout home: protocol and repair line tell the user to exit omp and relaunch through fm <project> ✅ pass live render.txt
Checkout home (FM_HOME unset): protocol and repair line keep the old restart wording and do not name fm <project> ✅ pass live render.txt
Session start for the checkout home prints old wording and no OMP_WATCH_CAUSE; marker-pid cause still prints for a foreign pid ✅ pass live omp-session-start.txt
A current omp marker written before lock acquisition is still accepted ✅ pass live omp-session-start.txt
Real omp primary launched bare from the firstmate folder is refused by the arm tool ⏸️ untested no Not driven here; the change is guidance text only and the captain posted real omp 18.10.2 evidence on the upstream PR. Run the omp live e2e test with a logged-in omp to cover it.
Evidence: Rendered omp guidance, non-checkout vs checkout home

Source: Rendered omp guidance, non-checkout vs checkout home

== non-checkout home, repair line
repair a missing or failed watcher cycle with the omp tool fm_watch_arm_omp, or exit omp and relaunch through `fm <project>` (the launcher sets FM_HOME and --cwd) so ~/.no-mistakes/worktrees/7c1e60802412/01M532407N53DTH89X2THGX9T3/.omp/extensions/fm-primary-turnend-guard.ts and ~/.no-mistakes/worktrees/7c1e60802412/01M532407N53DTH89X2THGX9T3/.omp/extensions/fm-primary-omp-watch.ts load for this home; a bare omp or /resume from the firstmate checkout does not register the extensions for this home.
== non-checkout home, protocol
16:   If `bin/fm-session-start.sh` reported the omp extensions as not loaded, exit omp and relaunch through `fm <project>`, which sets FM_HOME and --cwd; a bare omp or /resume from the firstmate checkout does not register the extensions for this home.
27:10. Missing, failed, or unhealthy cycle only: if a later notification explicitly reports one of those repair conditions, drain queued wakes, inspect the failure text, call `fm_watch_arm_omp`, and exit omp and relaunch through `fm <project>` if the extensions are not loaded.
== checkout home, repair line
repair a missing or failed watcher cycle with the omp tool fm_watch_arm_omp, or restart omp inside this home so ~/.no-mistakes/worktrees/7c1e60802412/01M532407N53DTH89X2THGX9T3/.omp/extensions/fm-primary-turnend-guard.ts and ~/.no-mistakes/worktrees/7c1e60802412/01M532407N53DTH89X2THGX9T3/.omp/extensions/fm-primary-omp-watch.ts auto-load from .omp/extensions/ (use -e with both paths only when starting omp from another directory).
== checkout home, protocol
16:   If `bin/fm-session-start.sh` reported the omp extensions as not loaded, restart omp inside this home; pass `-e ~/.no-mistakes/worktrees/7c1e60802412/01M532407N53DTH89X2THGX9T3/.omp/extensions/fm-primary-turnend-guard.ts -e ~/.no-mistakes/worktrees/7c1e60802412/01M532407N53DTH89X2THGX9T3/.omp/extensions/fm-primary-omp-watch.ts` only when omp must start from another directory, because omp loads a file named both ways twice.
27:10. Missing, failed, or unhealthy cycle only: if a later notification explicitly reports one of those repair conditions, drain queued wakes, inspect the failure text, call `fm_watch_arm_omp`, and restart omp inside this home if the extensions are not loaded.
Evidence: omp session-start test results

Source: omp session-start test results

ok - session start emits the omp block and reports omp extension load state
ok - omp diagnostic keeps today's wording for the checkout home and names the establishable cause
ok - session start accepts current omp markers written before lock acquisition
OMP_SELECTED_OK

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 5 scenarios driven live against the product
Scenario Result Live Evidence
Non-checkout home: protocol and repair line tell the user to exit omp and relaunch through fm <project> ✅ pass live render.txt
Checkout home (FM_HOME unset): protocol and repair line keep the old restart wording and do not name fm <project> ✅ pass live render.txt
Session start for the checkout home prints old wording and no OMP_WATCH_CAUSE; marker-pid cause still prints for a foreign pid ✅ pass live omp-session-start.txt
A current omp marker written before lock acquisition is still accepted ✅ pass live omp-session-start.txt
Real omp primary launched bare from the firstmate folder is refused by the arm tool ⏸️ untested no Not driven here; the change is guidance text only and the captain posted real omp 18.10.2 evidence on the upstream PR. Run the omp live e2e test with a logged-in omp to cover it.
  • FM_HOME=<tmp> bin/fm-supervision-instructions.sh --harness omp [--repair-line] vs env -u FM_HOME (rendered output captured)
  • bash tests/fm-supervision-instructions.test.sh (all passed)
  • Targeted run of three omp tests from tests/fm-session-start.test.sh: supervision block and diagnostic, checkout-home wording with no OMP_WATCH_CAUSE plus marker-pid cause, prelock marker accepted
  • Full bash tests/fm-session-start.test.sh also ran in the background and exited 0
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@avivl

avivl commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Friendly ping: this branch is ready for review, and the fork workflow runs still need approval from a maintainer before CI can run. Thanks.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @avivl, and thanks for the ping. I reviewed the diff and approved the fork workflow runs on 8c244516, so CI and the no-mistakes check are running now.

The change reads well to me: the non-checkout omp guidance and the warning-only OMP_WATCH_CAUSE line are scoped to the already-failing "extension not loaded" path, and the checkout home keeps today's wording.

One thing is still needed from you before this can land: the PR's own live validation is 0 of 5 scenarios driven live (fixture tests only). Could you live-test it, for example in a disposable bin/fm-live-lab.sh home with a real omp primary started bare from the checkout vs. through fm <project>, and post the evidence here, or re-raise through no-mistakes so the live-validation step records it? While you're there, a rebase onto latest main (the branch is 22 commits behind) would help too.

This is waiting on you (not a captain hold). Thank you for taking the time on this.

@avivl

avivl commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

Live evidence for the omp restart-hint change (head 8c24451642953372d7524d71e7303c4e3d99814b), driven against a real omp.

omp version: omp/18.10.2 (omp --version)

Columns:

  • base = origin/main at 5f2b81b
  • head = PR head 8c24451642953372d7524d71e7303c4e3d99814b, exported as is
  • rebased = the two PR commits rebased onto that origin/main (feb5cb9d28a24d6ba9b98cb71b471135e325fc22); the rebase applied with no conflicts

Method: each tree was exported with git archive into a scratch directory and copied per scenario. Real omp 18.10.2 ran in --mode rpc --no-session --auto-approve inside a fresh temporary home, launched with env -i (explicit PATH without herdr, tmux or gh; no inherited FM_HOME or HERDR_*). Every command below was executed by omp's own bash tool (or omp's own fm_watch_arm_omp tool), so the session pid and ancestry the scripts see are the real omp process. $CK is the exported checkout copy, $LH a fresh lab home. HOME was pointed at an empty directory for the session-start script only.

# Scenario base head rebased
1 Home that is not the checkout says to exit omp and relaunch through fm <project>; checkout home keeps the old wording n/a (old wording only: "restart omp inside this home; pass -e ...") PASS PASS
2 Checkout home, FM_HOME unset, old wording and no OMP_WATCH_CAUSE old wording, no CAUSE (pre-change behavior) PASS PASS
3 Warning-only OMP_WATCH_CAUSE when the marker pid is not the current session no CAUSE line (feature absent) PASS PASS
4 Current marker written before lock acquisition is still accepted PASS (no OMP_WATCH lines) PASS PASS
5 Bare omp from the checkout attaches to the checkout home and the arm tool refuses; FM_HOME=$LH omp --cwd $CK does not same as head (the PR does not change this) PASS PASS

Scenario 1, commands and trimmed output (head):

# home elsewhere: FM_HOME=$LH omp --no-extensions --cwd $CK ; tool: cd $CK && bin/fm-session-start.sh
OMP_WATCH_EXTENSION: not loaded - exit omp and relaunch through `fm <project>` (the launcher sets FM_HOME and --cwd) so .../fm-primary-turnend-guard.ts and .../fm-primary-omp-watch.ts auto-load for this home; a bare omp or /resume from the firstmate checkout does not register the extensions for this home
2. ... If `bin/fm-session-start.sh` reported the omp extensions as not loaded, exit omp and relaunch through `fm <project>`, which sets FM_HOME and --cwd; a bare omp or /resume ...
10. ... call `fm_watch_arm_omp`, and exit omp and relaunch through `fm <project>` if the extensions are not loaded.
# base for the same command:
OMP_WATCH_EXTENSION: not loaded - restart omp with this home as its working directory so ... pass -e ... -e ... only when omp must start from another directory ...
2. ... restart omp inside this home; pass `-e ... -e ...` only when omp must start from another directory ...

Scenario 2 (head and rebased): omp launched bare (FM_HOME unset, confirmed FM_HOME in tool env=[UNSET]) with --no-extensions in $CK, then cd $CK && bin/fm-session-start.sh:

OMP_WATCH_EXTENSION: not loaded - restart omp with this home as its working directory so ... auto-load from .omp/extensions/ ...; pass -e ... -e ... only when omp must start from another directory ...
(no OMP_WATCH_CAUSE line; supervision text says "restart omp inside this home")

Scenario 3 (head): omp A (FM_HOME=$LH omp --cwd $CK, extensions auto-loaded) wrote both markers on its own; state/.omp-watch-extension-loaded = sha256:cffc47d1... then pid 69550 (A's real pid). Then omp B, launched bare from $CK (no FM_HOME, so its extension attaches to the checkout home, not $LH), ran cd $CK && env FM_HOME=$LH bin/fm-session-start.sh:

lock acquired: harness pid 70006
OMP_WATCH_EXTENSION: not loaded - exit omp and relaunch through `fm <project>` ...
OMP_WATCH_CAUSE: the extension marker $LH/state/.omp-watch-extension-loaded names pid 69550, which is not this session (pid 70006)

Marker pid 69550 is A's real pid and 70006 is B's real pid (ps ancestry captured in the same file). Rebased run: marker 98528, session 5150, same text. Base run: marker 96494, session 4807, OMP_WATCH_EXTENSION line only, no CAUSE.

Scenario 4 (all columns): FM_HOME=$LH omp --cwd $CK (extensions auto-load). Before any lock: .omp-watch-extension-loaded and .omp-turnend-extension-loaded both hold the current build hash and omp's pid (head: 64004). Then, through omp's bash tool, cd $CK && bin/fm-session-start.sh:

lock acquired: harness pid 64004
(no OMP_WATCH_EXTENSION line, no OMP_WATCH_CAUSE line)
state/.lock = 64004, marker pid = 64004

Scenario 5 (all columns, identical):

# stand-in for the checkout home's live primary: real omp P (--no-extensions, bare, cwd $CK) ran bin/fm-lock.sh
lock acquired: harness pid 73924          ($CK/state/.lock = 73924)
# D: bare omp from $CK, no FM_HOME (confirmed UNSET); real omp tool call fm_watch_arm_omp:
watcher: read-only - session lock is held by another firstmate session
# D's state landed in $CK/state (checkout home); nothing was created in the lab home $LH/state
# E: FM_HOME=$LH omp --cwd $CK; bin/fm-session-start.sh acquired the lab lock (77458), then fm_watch_arm_omp:
watcher: started omp extension arm child 1; future ordinary re-arms are automatic; ...
# $LH/state now holds .lock=77458, both markers, and the watcher lock

This confirms the failure the PR text describes: the bare launch attaches to the checkout home and is refused there, while the fm <project> style launch attaches to the intended home.

Tests on the rebased tree (feb5cb9d): tests/fm-session-start.test.sh exit 0 (62 ok lines, no failures); tests/fm-supervision-instructions.test.sh exit 0 (13 ok lines, no failures). Both ran with an env -i environment and a PATH without herdr.

Not driven live, or caveats:

  • The fm <project> launcher itself was not run; scenario 5 reproduced what it does by hand (FM_HOME=<lab home> omp --cwd <checkout export>) because running it would touch real registered projects and homes.
  • Scenario 2 and the checkout half of scenario 1 used --no-extensions to force the not-loaded branch; the not-loaded state for a checkout home was therefore induced, not reached through a genuine bare-launch mistake.
  • Scenario 5's "other session holds the checkout lock" was a real second omp that ran bin/fm-lock.sh in the exported checkout, not the captain's live checkout home.
  • The omp model was driven by prompt (openai-codex/gpt-6-astra) and occasionally refused to run a command verbatim; those turns were re-sent, and the commands that ran are the ones recorded.
  • Side observation, not a failure: with FM_HOME unset (checkout home) and a stale marker naming a dead pid, head also prints OMP_WATCH_CAUSE (an accidental run, because an earlier omp --help in the export wrote a marker). That follows the code (the line depends on the marker pid, not on FM_HOME) and looks intended, but it differs from a reading of "no cause line when FM_HOME is unset".

CI note: the one failing shard in the approved run is Behavior portable parallel 1, and the failing script is tests/fm-pi-primary-types.test.sh. It reports Property 'prompt' does not exist on type 'BeforeAgentStartEvent' in the Pi extensions, which this change does not touch. That run was created on 2026-10-12 from the pull request merge commit of that day, and main fixed the matching Pi type error in #7248 on 2026-10-14 ("narrow before_agent_start events before reading prompt"). The rebase below should pick that fix up.

Next step: I will push the rebase through no-mistakes so the head matches the rebased column. The scratch rebase applied with no conflicts, and both test files and the five scenarios pass on it. The pushed head may have a different sha than feb5cb9d because the pipeline rebases on its own.

@avivl
avivl force-pushed the avivl/omp-restart-hint-upstream-pr branch from 8c24451 to 9c821ea Compare October 16, 2026 19:23
@avivl avivl changed the title fix(bin): tell non-checkout omp homes to relaunch via fm <project> fix(bin): point non-checkout omp homes at fm <project> relaunch Oct 16, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you, @avivl. This resolves both things I asked for.

  • Live evidence: your real omp 18.10.2 run covers all five scenarios, on the PR head and on a rebase onto main. It drove the non-checkout relaunch wording and the unchanged checkout-home wording, and showed that OMP_WATCH_CAUSE fires only for a foreign marker pid. A current marker written before the lock is still accepted, and the bare-omp attach to the checkout home is confirmed as pre-existing behavior. The body's no-mistakes Live validation is 4/5 go on top of that.
  • Rebase plus re-raise: head 9c821eab is attested (MATCH), 2 ahead and 4 behind main d20196ae, and MERGEABLE. It also applies the round-1 decision to drop the unset-FM_HOME cause line.

I re-read the diff against main. The relaunch-through-fm <project> wording appears only when the physical home differs from the checkout, and only inside the existing "extension not loaded" diagnostic and the omp repair line. OMP_WATCH_CAUSE is warning-only. Nothing touches workflows, CI scripts or secrets. On that basis I approved this head's fork runs: CI 38954590628, and Require no-mistakes 38954590696 and 38954629434.

Contract-class: restore (my own read, unchanged). The repair guidance for a non-checkout omp home was the existing default path, and it gave advice that couldn't work. VISION: every rule aligns (unchanged).

Where this stands: waiting on CI only, with nothing needed from you. If CI and the no-mistakes check come back green and it's still mergeable, it auto-merges.

@avivl

avivl commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Friendly ping: all 20 checks on head 9c821ea are green and the PR is mergeable. Per your note of 2026-10-17 it was waiting only on CI. Thanks.

@kunchenguid
kunchenguid merged commit 83b70ef into kunchenguid:main Oct 21, 2026
20 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

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

Thanks for the ping too, and sorry it sat after CI went green. Before merging I re-read head 9c821eab against main 3847411b (nothing on main touched these files since), confirmed every check was green with the no-mistakes attestation bound to this head, and your live omp 18.10.2 run covers the change. contract-class: restore.