Repository navigation
Conversation
…-control verb - Add `fm-control.sh <task> switch-model --model <provider/id> [--effort <level>] [--wait <s>] | --status`. The request is files in the task's doorbell request directory, applied by the worker's own extension through OMP's session-only `setModel` and `setThinkingLevel`, never typed into the TUI. - Add `.omp/extensions/lib/fm-task-model-switch.ts`, which owns the wire contract. A request applies while the session is idle or inside the awaited `turn_end` or terminal `agent_end` handler, never mid-stream. Every request carries a unique id, and the acknowledgement records the id, the model and thinking level before and after, and a typed outcome (applied, partial, refused, superseded). - On timeout the verb withdraws the request by an atomic rename the worker's claim cannot also win (cancelled), or reports pending-unknown with the request id. `--status` and every later verb fold a late acknowledgement into task meta, and a changed worker generation is never rewritten (meta-stale). Task meta and the Herdr pane label change only after the extension's readback equals the target. - Refuse non-OMP harnesses, secondmates, and workers that predate the channel with the concrete reason. - Tests: a fake-host extension test, a verb test (refusals, mid-turn deferral, cancellation, late acknowledgement, partial, meta-stale), an SDK typecheck of the library, and an opt-in live Herdr-lab guard (idle and mid-turn switches, documented resume, unchanged global OMP config). - The busy-wiring test's fake OMP host now runs every handler registered for an event, as OMP does. - Document the verb in the fm-control header, the harness-adapters omp table, agent-control, and the Herdr pane label contract, and record the dated live result in runtime-backends verification.
…n-admission gate - Drop the turn_end boundary: OMP does not await extension turn_end handlers, so a slow setter landed mid-run (probed on OMP 18.22.2). - Apply at settled idle (terminal agent_end or the idle watcher) when the message queue is empty, with credentials resolved first. - Hold the apply in one capped critical section: before_agent_start and the inbox doorbell wait on a process-global gate. - Count provider requests prepared during the apply and report raced instead of a clean switch. - Require the emitted ack sequence as the only order field, take only separate --model/--effort arguments, and limit relaunch coordination to OMP transitions. - Use a monotonic deadline with one last receipt check, rank a folded receipt above a leftover claim, and always republish the pane label for the newest verified receipt. - Run the live guard from an explicit Git revision and prove the busy case: the whole in-flight run stays on the old model, the next turn runs on the new one.
…ive guard - The echoed prompt text satisfied the old wait before the turn had run, so the model check could read an empty reply.
…ell lib to its gate tests - Replace the awaited turn_end claims in the verification record with the probe evidence and the 2026-11-23 live result. - Run the gate tests when the doorbell library changes.
…ch picker - Drop the settled-idle wait, the turn-admission gate with its doorbell hold, the queued-message check, the race witness and its raced result, and the boundary field. - The extension claims a request as soon as it sees it and calls the session-only extension setter pi.setModel then pi.setThinkingLevel; the request in flight finishes on the old model and the next one uses the new model, even mid-task. - Keep the request-file channel, the typed refusals, partial and superseded results, the ack sequence, readback, and the meta update; keep the bounded ack wait with cancel-with-proof or pending-unknown, now 15 s by default. - Record the native thinking level in meta and clear stale effort only when the model reports none; restore the doorbell library and its test mapping. - Rework the fake host and tests: a busy session with queued messages is switched at once, a stopped extension proves cancellation, and the live guard shows the in-flight request on the old model and the next on the new one.
- The turn-admission gate hold no longer exists, so the doorbell needs no change.
- Replace the settled-idle wording with the picker-equivalent behavior and the 2026-11-23 live run from commit c5f87a0.
…st, order status by sequence, trim extras - Refuse an effort on a target with no thinking levels with the typed effort-unsupported before changing anything. - Fold late receipts before the channel check refuses a switch, and derive the latest result from the emitted sequence. - Document once in the fm-control header that a streaming Responses-WebSocket reply can be cut, as with the picker. - Use one internal poll interval, drop the unconsumed ack pid and ready timestamp, the fake responder's busy and idle commands, and the extra operator docs. - The live guard blocks a fixture tool until the switch receipt arrives and checks that the first later request ran on the new model.
…marker - The worker reads its inbox message with tool calls first, so the guard waits for the call that names the release file.
… sleep - OMP turns a long polling loop into a background job and ends the turn, so the guard uses a 25-second foreground sleep and requires the switch receipt to arrive while its tool call is unanswered.
…ly in the live guard - After the switch the worker acknowledges its inbox message before replying; every one of those requests must run on the new model, and one of them carries the reply.
dnth
force-pushed
the
fm/fm-control-switch-model
branch
from
November 24, 2026 06:05
59237ad to
82c6196
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fm-control.sh <task> switch-modelchanges a live OMP worker's model and thinking level inside its current session.It applies at once, like OMP's own
/switchpicker: the request already in flight finishes on the old model, and the next request uses the new one, even mid-task.setModelTemporary, the picker's setter, is not exposed to extensions, so the extension callspi.setModelthenpi.setThinkingLevel, which are the session-only equivalents.On a Responses-WebSocket model a reply already streaming can be cut by the switch, the same as the picker; the
fm-control.shheader documents that once.Removed after review and a captain decision: any idle wait, turn-admission gate, queued-message check, race result, and boundary field.
The inbox doorbell library is unchanged from main.
Evidence
/model <id>sent to a busy worker arrived as chat,/switchcould not be typed, and task meta and the Herdr label kept the old model.After: live Herdr-lab guard on OMP 18.22.2 and Herdr 0.9.5, driven from commit
832c8e29of the earlier history (ran, exit 0; later pipeline fix commits changed code, and the pipeline's own live Test run below covers the final head):sleeptool call is unanswered: that call's request ran on the old model, the model-change entry precedes its result, and every later request ran on the new model; the user-message sequence shows no/modelor/switchchat;--model) keeps the switched model;~/.ompconfig files are byte-identical before and after, and the default Herdr session is intact.tests/fm-omp-task-model-switch.test.sh(refusal matrix including a target with no thinking levels, partial, superseded, withdrawn, ownership) andtests/fm-control-switch-model.test.sh(mid-task apply, cancellation with proof via a stopped extension, late receipt reconciliation including for an exited worker, status ordered by acknowledgement sequence, native thinking recorded, argument contract).I broke the code on purpose for the effort preflight, the receipt fold order and the status order; each test failed as intended (ran).
53837e29: 20 of 20 checks passed (cited,gh-axi pr view).The first CI round here had failures that also fail on main; main's runner pin to
ubuntu-24.04(merged separately) fixed them, and the pipeline rebased onto it.The Stock macOS Bash snapshot job then failed for a real reason in this change:
tests/fm-omp-task-model-switch.test.shheld a quoted heredoc inside a command substitution, which Bash 3.2 cannot parse (line 236).The pipeline's CI fix round removed the command substitution, and the job passes.
d0ec00f0equals the old origin/main):fm-omp-harness,fm-omp-relaunch-guard,fm-omp-branch-types,fm-omp-primary,fm-send-turn-start.These are local-environment failures; they pass on CI's pinned image.
Deferred findings
By captain decision the PR ships after its last fix round with these findings left open; no issue was commented on.
Raised by the final review round (this pipeline run):
omitted-effort-differs-from-omp-picker-role-preference(ask-user): without--effortthe extension skips the thinking setter, so a role-configured effort that the picker would apply is not applied, and the receipt records the retained level as a success.unrequired-switch-option-repetition(ask-user): a repeated--model,--effortor--wait, or a repeated--status, is accepted with last-value-wins instead of being refused.unrequired-live-guard-selection-for-fake-host-edits(ask-user):bin/fm-test-run.shmaps a fake-host edit to the opt-in live guard, which never loads that fixture.relaunch-stops-worker-after-known-fold-failure(auto-fix, not applied): an OMP relaunch can stop a healthy worker when a late receipt is already known to be unreconciled.status-can-report-success-with-unfolded-receipt(auto-fix, not applied):--statuscan exit 0 withlast-state=acknowledged-unfoldedandunresolved=0when the receipt lands between two scans.Raised by the previous pipeline run's last re-review and not raised again by this rerun (not fixed or re-verified by me):
switch-publishes-after-its-own-deadline: the staged request is made visible without re-checking the deadline.unrequired-live-guard-keep-running-mode: theFM_OMP_MODEL_SWITCH_KEEP_FAILEDmode of the live guard is not needed.resume-can-regress-acknowledgement-sequence: after a same-generation resume a backward clock step can seed the acknowledgement sequence below an already-folded one.switch-fixture-cleanup-signals-reaped-pids: the fixture cleanup can signal a reused PID.The Pipeline Review block below lists the findings as the pipeline recorded them.
Merge Danger
Door: two-way.
The change adds one lifecycle verb and an extension channel, and it restricts a relaunch's switch coordination to OMP transitions; reverting the merge removes both.
The branch also carries main's CI runner pin through the rebase; that file is not part of this change's diff against main.
Blast Radius: OMP workers
A switch is session-only and never edits global config, but a worker launched before this lands has no channel and is refused until it is relaunched.
On a Responses-WebSocket model, a switch can cut a reply that is still streaming.
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-control.sh:1594- An OMP relaunch can stop a healthy worker when a late switch receipt is already known to be unreconciled. If a concurrent steer holds the task metadata lock beyond the fold budget, the pre-relaunch fold failure is discarded here. Relaunch then callsdo_exitat bin/fm-control.sh:1529 and aborts if the fold still fails at bin/fm-control.sh:1532. Reject a known reconciliation failure before stopping the worker and retain the post-stop check for receipts that arrive during shutdown. The direct spawn path already refuses an unfolded current-generation receipt at bin/fm-spawn.sh:4419.bin/fm-control.sh:1048- Status can exit 0 withlast-state=acknowledged-unfoldedandunresolved=0. After the fold scan at bin/fm-control.sh:1096, the request-ID glob at bin/fm-control.sh:1047 can capture only the processing file. If OMP publishes the receipt and removes the claim at .omp/extensions/lib/fm-task-model-switch.ts:221 and :363 before the shell checks that path, the ID is omitted from the count. The later scan sees the receipt and updates only the last result at bin/fm-control.sh:1113–1116. Derive the count and exit result from the same observations, including any newly seen unresolved receipt..omp/extensions/lib/fm-task-model-switch.ts:273- The accepted design says “exactly like OMP’s own /switch picker.” Without--effort, this hunk callspi.setModeland skips the thinking setter at .omp/extensions/lib/fm-task-model-switch.ts:286. If the current effort islowand the target supportslowandhighwith a configured role usinghigh, OMP’s picker applies the role’shigh, while the extension setter can retainlow. The receipt at .omp/extensions/lib/fm-task-model-switch.ts:309 and metadata fold at bin/fm-control.sh:832 then recordlowas a successful switch. Decide whether omitted effort should follow the picker’s role preference or the extension setter’s native result. OMP picker · OMP model controlsbin/fm-control.sh:309- The switch parser adds last-value-wins handling for repeated--model,--effort, and--waitat bin/fm-control.sh:309–314 and accepts repeated--statusat bin/fm-control.sh:354. For example,--model p/a --model p/bsilently switches top/b. The intent needs one value per option or standalone--status. Remove duplicate-option acceptance for this verb.bin/fm-test-run.sh:1017- A change confined to the fake host selects the live OMP guard, which never loads that fixture. With the live opt-in already set, a fake-only edit starts a real lab and spends model turns. No acceptance criterion needs live execution for that input. Remove the fake-host-to-live-guard mapping and keep the two fake-host consumers at bin/fm-test-run.sh:1015–1016.✅ **Test** - passed
✅ No issues found.
FM_OMP_MODEL_SWITCH_LIVE_E2E=1 FM_OMP_MODEL_SWITCH_LIVE_REV=86b197c8b40c1199b18adf2fb213c03bcf40b0c6 FM_OMP_MODEL_SWITCH_LIVE_FROM=lab/alpha FM_OMP_MODEL_SWITCH_LIVE_TO=lab/beta bash tests/fm-omp-model-switch-live-e2e.test.shin a disposable network and PID namespacebash /tmp/guard-extra.shagainst the archived target with the local streaming and metadata provider, includingfm-control.sh <task> switch-model --wait 1andswitch-model --statusbash /tmp/guard-relaunch.shagainst the archived target, includingfm-control.sh <task> relaunch --note <test note>and old-generation request and receipt replaybun /tmp/sdk-partial-18.mjs "$PWD/.omp/extensions/lib/fm-task-model-switch.ts"with the real OMP 18.22.2 SDK and a synthetic low effort ceilingbash tests/fm-control-switch-model.test.shandbash tests/fm-omp-task-model-switch.test.shfor supplemental portable coveragetimeout -k 3s 75s bash tests/<selector>.test.shon archived d0ec00f0 and 86b197c8b40 forfm-omp-harness,fm-omp-relaunch-guard,fm-omp-primary, andfm-send-turn-startherdr session attach <lab>in a sized, drained PTY to render and inspect the sidebar screenshottests/fm-omp-branch-types.test.sh:52- The SDK check comment listsctx.isIdleamong the fields it verifies. The checked model-switch context omits that field. The test file falls outside this documentation phase.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.