Repository navigation
feat(bin): pin a local omp secondmate to its own omp profile - #7738
Conversation
Add the opt-in config/secondmate-accounts/<id>/omp-profile file in the primary home. When present, that local secondmate's omp agent launches with --profile <name> and its pre-launch catalog check reads the same profile; the pin is recorded as omp_profile= in the task record and on the spawned line. A malformed file refuses before any endpoint, local copy, or record exists, and a relaunch checks it before stopping the running agent. An absent file leaves every launch unchanged.
|
Speaking as Kun's firstmate: thank you @craighurdman, this is a clean, narrow change, and the live table covers both the refusal paths and the unpinned case. What I checked on head Contract-class: opt-in. Next step: once CI is green and the branch still merges cleanly, this can merge on the next pass. It's waiting on CI now, not on you. |
|
Speaking as Kun's firstmate: this is merged. Thank you @craighurdman — really appreciate you taking the time on this. |
Intent
Add support for launching a local omp secondmate with its own isolated
omp --profile <name>auth/session/cache profile, distinct from the primary's own omp credentials.Context: the captain runs two separate omp identities today, by hand: a default profile for one set of clients, and a dedicated
omp --profile speak4identity (its own auth, sessions, cache under~/.omp/profiles/speak4/) for their most important client, speak4. Firstmate is about to seed a persistentspeak4secondmate whose own omp agent should launch under that same isolatedspeak4profile rather than the primary's ambient omp credentials.bin/fm-spawn.shcurrently has no way to pass--profileto an omp launch at all, local secondmate or otherwise - every omp launch uses whatever the ambientompbinary resolves by default.What Changed
bin/fm-omp-profile-lib.sh, which reads an opt-in pin fromconfig/secondmate-accounts/<id>/omp-profilein the primary home. Only a local secondmate's own omp agent uses it. The name must follow omp's profile rule:^[a-z0-9][a-z0-9._-]{0,63}$, no trailing., and no Windows reserved device names. A file that is empty, malformed, unreadable or not a regular file causes a refusal, and so does a raw omp launch command for a pinned mate. When the file is absent, nothing about the launch changes.bin/fm-spawn.shchecks the pin before any endpoint, worktree or record exists. With a pin, the omp launch template gets--profile '<name>'right after the omp binary through a new__OMPPROFILE__placeholder, and the model-catalog check (omp models --json) runs under the same profile. The spawn also writesomp_profile=to the task record and the spawned line, and keeps it through relaunches.bin/fm-control.shchecks the pin before a relaunch stops the live agent.docs/configuration.md("Per-secondmate omp profile"), the omp harness adapter reference,docs/agent-control.md, the operational-home-layout skill and the runtime-backends verification notes. Added coverage intests/fm-omp-harness.test.sh.🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change is opt-in and only adds a flag when a pin file exists; an absent file leaves the launch unchanged. Spawn and relaunch both check the pin before any fleet change, and remote secondmates cannot run omp at all, so the only gaps are a rare reserved-name edge case and an optional record field.
Testing
I ran the targeted omp harness test file (it passes, including the new profile-pin cases). I then drove four scenarios live against real omp and real firstmate scripts in a disposable lab home with a private tmux socket and an isolated omp HOME: a pinned spawn, an unpinned spawn, a spawn refused for a reserved-name pin, and a relaunch refused before stop for a malformed pin. All four passed. I captured the CLI output, the task records, the live process argv, and the pane content as evidence, then tore the lab down. This is a CLI and process change with no visual UI, so there are text transcripts and no screenshots. Not exercised: a relaunch with a valid pin that completes. The stop step refused because the unauthenticated lab omp sat on a model error screen, which the control layer reads as an 'ambiguous' state. That refusal comes from the existing control layer, not from this change. Re-reading the pin on relaunch is shown by the pre-stop refusal.
omp --profile fmlab4 --config …; sm.meta has omp_profile=fmlab4; spawned line ends omp_profile=fmlab4; $LAB/ohome/.omp/profiles/fmlab4/{agent,cache,logs,run} created by th…omp --config; 0 omp_profile lines in sm2.meta; spawned line has no omp_profile; no new profile dirfm-control relaunch --harness ompbefore the running omp agent is stoppedEvidence: Pinned omp secondmate spawn: spawned line, task record, live omp argv with --profile fmlab4, isolated profile dir, pane
Source: Pinned omp secondmate spawn: spawned line, task record, live omp argv with --profile fmlab4, isolated profile dir, pane
Evidence: Unpinned omp secondmate spawn: no --profile, no omp_profile record
Source: Unpinned omp secondmate spawn: no --profile, no omp_profile record
Evidence: Reserved-name pin (aux) refuses the spawn before any state or window
Source: Reserved-name pin (aux) refuses the spawn before any state or window
Evidence: Malformed pin (nul.x) refuses fm-control relaunch before the live omp is stopped
Source: Malformed pin (nul.x) refuses fm-control relaunch before the live omp is stopped
Evidence: Live pinned omp argv
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-omp-profile-lib.sh:42- The pin check claims to match omp's own profile rule, but it skips one part of that rule: omp also rejects Windows reserved device names on every platform (con, prn, aux, nul, com0-9, lpt0-9, and any of those with an extension, such asnul.x). The verification record in docs/verification/runtime-backends.md:3216 shows this in omp's own error. So a pin likeauxpasses fm_omp_profile_read. Then omp_model_validate swallows omp's failure, because an unreadable listing returns 0 (bin/fm-spawn.sh:2488). The spawn goes on to create the endpoint, worktree and record, and only the launched omp fails. That contradicts the documented promise to refuse "before any endpoint, local copy, or task record exists" (docs/configuration.md:1327). Fix: in the perl check, also exit 6 when the name matches /\A(con|prn|aux|nul|com[0-9]|lpt[0-9])(.|\z)/, and add that to the error text in fm_omp_profile_select (line 73). The same check covers the fm-control pre-stop path because it shares the same function.bin/fm-spawn.sh:6572- Simplification: the change records the pin asomp_profile=in the task record (bin/fm-spawn.sh:6572, plus its entry in the preserve_relaunch_meta key list at 6531) and on the spawned line (bin/fm-spawn.sh:7398). Nothing in bin/ reads this field back. The intent only requires that a local omp secondmate launch with--profile <name>. This is extra observability that copies the account-pin precedent, not something the intent asks for. Remedy: remove the record and spawned-line output (and the related docs sentence at docs/configuration.md:1331), unless the author wants it for operator visibility.🔧 Fix applied.
1 warning still open:
bin/fm-spawn.sh:6572- Simplification: the change records the pin asomp_profile=in the task record (bin/fm-spawn.sh:6572, plus its entry in the preserve_relaunch_meta key list at 6531) and on the spawned line (bin/fm-spawn.sh:7398). Nothing in bin/ reads this field back. The intent only requires that a local omp secondmate launch with--profile <name>. This is extra observability that copies the account-pin precedent, not something the intent asks for. Remedy: remove the record and spawned-line output (and the related docs sentence at docs/configuration.md:1331), unless the author wants it for operator visibility.🔧 **Test** - 1 issue found → no changes applied ✅
🔧 No changes applied.
✅ Re-checked - no issues remain.
omp --profile fmlab4 --config …; sm.meta has omp_profile=fmlab4; spawned line ends omp_profile=fmlab4; $LAB/ohome/.omp/profiles/fmlab4/{agent,cache,logs,run} created by th…omp --config; 0 omp_profile lines in sm2.meta; spawned line has no omp_profile; no new profile dirfm-control relaunch --harness ompbefore the running omp agent is stoppedbash tests/fm-omp-harness.test.sh(targeted omp harness suite, including the three new omp-profile cases, all ok)Live lab:bin/fm-lab-home.sh create $LAB, private tmux servertmux -L fm-labwith FM_HOME=$LAB and HOME=$LAB/ohome, thenbin/fm-spawn.sh sm <sm-home> omp --secondmatewith config/secondmate-accounts/sm/omp-profile=fmlab4; checked the live omp argv via ps, the sm.meta record, the spawned line, the $LAB/ohome/.omp/profiles/fmlab4 tree, and the omp paneLive lab: wrotenul.xto the pin, ranbin/fm-control.sh sm relaunch --harness omp, and confirmed it refused naming the file while the live omp PID kept runningLive lab:bin/fm-spawn.sh sm2 <sm2-home> omp --secondmatewith the pinaux; confirmed exit 1, the error names the file, and there is no sm2 state or tmux windowLive lab: same sm2 spawn with no pin file; confirmed the live omp argv has no --profile, the record has no omp_profile line, and the spawned line has no omp_profileTeardown:tmux -L fm-lab kill-server, then removed the lab home, both secondmate homes, and /tmp/fm-sm*✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.