Repository navigation
feat(omp): show and switch the OMP model in native chat - #17609
SudoAI-DEV wants to merge 4 commits into
Conversation
…tablyai#17603) OMP sessions showed no model pill in native chat — on mobile or desktop — because nothing in the pipeline knew OMP's model: - src/shared/agent-session-option-catalog.ts had no omp entry, so the composer had no model descriptor to render. - The extension Orca installs into omp posted no model, so agentStatus.model stayed empty and the pill could never name the current session model. Add an OMP catalog with no static seed (OMP's selectable models are whatever providers the user configured, nothing is available everywhere) that launches with --model <provider/id>, switches mid-session with /model <provider/id> (omp resolves the selector exactly), and discovers models on desktop through omp models --json. Stamp ctx.model as provider/id on every post the extension makes under the OMP runtime, and pass it through pi-family normalization; a model_select event re-emits the pane's last status under the new model. Mobile widens its catalog gate to omp and keeps a hook-reported selector as the tracked row when the catalog seeds nothing, so the pill shows the running model and a pick dispatches /model. Pi is untouched: it has no chat surface (stablyai#13185) and its posts still carry no model. Part of stablyai#17603 (OMP half).
Greptile SummaryThe PR adds OMP model reporting, discovery, launch selection, and mid-session switching to native chat.
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains within the eligible follow-up-review scope. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| src/main/pi/agent-status-extension-source.ts | Adds OMP-only model metadata capture and includes it in generated status posts while preserving plain Pi behavior. |
| src/main/pi/agent-status-handler-source.ts | Registers OMP runtime model-selection reporting in the generated Pi-family extension. |
| src/shared/agent-hook-listener/providers/pi-family-events.ts | Normalizes OMP model metadata and re-emits the prior pane status when a model-selection event arrives. |
| src/shared/agent-session-option-catalog-omp.ts | Defines OMP model discovery, launch arguments, and mid-session model commands without a static model seed. |
| src/shared/omp-model-list-probe.ts | Parses and deduplicates the machine-readable OMP model listing. |
| src/shared/native-chat-session-option-state.ts | Preserves hook-reported model selectors for catalogs with no seeded models. |
| mobile/src/session/use-mobile-native-chat-session-options.ts | Enables existing mobile native-chat model controls for OMP sessions. |
Sequence Diagram
sequenceDiagram
participant OMP as OMP runtime
participant Hook as Orca status extension
participant Server as Hook normalizer
participant Chat as Native chat
participant Probe as Model discovery
OMP->>Hook: Lifecycle event with ctx.model
Hook->>Server: Status payload with provider/id
Server->>Chat: Normalized agent status
Probe->>OMP: omp models --json
OMP-->>Probe: Configured model catalog
Probe-->>Chat: Selectable model rows
Chat->>OMP: /model provider/id
Reviews (2): Last reviewed commit: "docs(omp): document the functions the mo..." | Re-trigger Greptile
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe change adds OMP model discovery from Merge Risk: 🔵 Low · up to OMP model discovery and switching are mergeable, but discovered model identifiers are inserted into the mid-session /model command without demonstrated validation as a single safe provider/id token. Please retain owner awareness and follow up with selector validation to avoid malformed or unexpected command input. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description is comprehensive and covers the required change summary, rationale, linked issue, testing, review notes, compatibility, and checklist. It also clearly records that packaged-app testing and full lint, test, and build runs remain for CI, although a real after visual proof is not yet available.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CodeRabbit's docstring gate counts JSDoc on every function the diff reaches; give each one a one-line contract so the intent survives outside the PR.
There was a problem hiding this comment.
Important
The hook-reported OMP model never reaches the desktop composer pill — only mobile wires agentStatus.model into the pill. Please confirm this is intentional before merging.
Reviewed changes
- OMP session-option catalog — new
agent-session-option-catalog-omp.ts(empty seed,--modellaunch arg,/model <selector>mid-session switch, authoritative discovery) registered alongside the other agents. omp models --jsonprobe — newomp-model-list-probe.tswired as a discovery-only spec inagent-model-probe-spec.tswithdefaultModelId: ''.- Model stamping on OMP posts —
agent-status-extension-source.tsstampsprovider/idon every OMP-runtime post (configured/hook/ompor Pi-kind title/argv detection only), plus amodel_selecthandler inagent-status-handler-source.ts. - Status normalization —
pi-family-events.tspassesmodelthrough and re-emits the last known status with the new model onmodel_select. - Unseeded-catalog fallback —
matchNativeChatCatalogModelIdkeeps the hook-reported selector when the catalog seeds no models; mobile widens its gate toomp. - Tests — new/updated coverage for the probe, extension source (run in a VM), server normalization, mobile hook, and the unseeded-catalog fallback.
⚠️ Desktop composer pill does not consume the hook-reported model
The PR's stated gap 2 is that agentStatus.model was empty, "so even with a catalog the pill could not name the running model." Mobile closes this loop: use-mobile-native-chat-controller.ts passes reportedModel: activeSessionTab?.agentStatus?.model, and the hook feeds it through matchNativeChatCatalogModelId into the pill. Desktop has no equivalent path — use-native-chat-session-options.ts computes reportedValues only for agent === 'claude' (terminal-screen reading), and neither of its useEffects runs for omp. The stamped model reaches the sidebar rows (DashboardAgentRow, worktree-card-compact-agent-row) but never the composer surface, so on desktop the OMP pill's current value is only ever populated by a persisted setting, a user pick, or a typed /model — the live report is ignored. Before discovery settles the snapshot is empty (no pill); after discovery the pill lists models with no selected value.
This looks like the same class of known limitation the PR already documents for mobile discovery, but it is not called out anywhere, and the "Why" section implies the pill should name the running model. If desktop naming is out of scope for now, worth stating; otherwise this needs agentStatus.model threaded into reportSessionOptions for omp.
Technical details
# Desktop pill never shows the live OMP model
## Affected sites
- src/renderer/src/components/native-chat/use-native-chat-session-options.ts:116 — `reportedValues` is `null` for every non-claude agent; the two `useEffect`s are gated on `agent === 'claude'`.
- mobile/src/session/use-mobile-native-chat-controller.ts:246 — mobile passes `agentStatus.model` as `reportedModel`; desktop has no analogue.
- src/renderer/src/components/native-chat/native-chat-pty-session-options.ts:76 — the only ingress for reported values into the desktop surface.
## Required outcome
- Decide whether desktop should show the hook-reported OMP model in the composer pill; if yes, thread `agentStatus.model` into the surface (e.g. a non-claude reported-values path), or document the limitation explicitly.
## Open questions for the human
- Is desktop "show" intended to be discovery-only (picker appears, user picks) rather than naming the running model?ℹ️ Nitpicks
parseJsonObjectinomp-model-list-probe.tsrecovers from a pre-JSON notice by slicingindexOf('{')…lastIndexOf('}'). A notice that itself contains a brace would grab the wrong span and degrade to an empty list. Consider trying to parse the trailing{…}segment first (or scanning candidate{offsets) rather than assuming the first{opens the payload.- The empty-seed fallback in
matchNativeChatCatalogModelIdis gated oncatalog.models.length === 0and is therefore generic, not OMP-specific. That is fine today (OMP is the only empty-seed catalog) but a comment scoping it to that intent would keep a future empty-seed agent from silently inheriting the behavior.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Important
On desktop, the OMP model pill never names the running model — the hook-reported model only reaches the pill on mobile. Please confirm whether desktop "show the model" is meant to be discovery-only or should also reflect the live report.
Reviewed changes
- OMP catalog — new
agent-session-option-catalog-omp.ts(no seed,discoveredModelsAreAuthoritative,--modellaunch arg,/model <selector>mid-session switch) registered alongside the other agents. - Probe —
omp-model-list-probe.tsparsesomp models --json, wired as a discovery-only spec inagent-model-probe-spec.ts(defaultModelId: ''). - Model stamping —
agent-status-extension-source.tsstampsprovider/idon every OMP-runtime post;agent-status-handler-source.tsadds a forward-lookingmodel_selecthandler. - Normalization —
pi-family-events.tspassesmodelthrough and re-emits the last known status with the new model onmodel_select. - Unseeded-catalog fallback —
matchNativeChatCatalogModelIdkeeps the reported selector when the catalog seeds no models; mobile widens its gate toomp. - Tests — probe/parse, launch-arg + override,
/modelround-trip, extension source in a VM, server normalization, mobile hook, unseeded fallback.
⚠️ Desktop pill never shows the live OMP model
The hook now stamps model on every OMP post and agentStatus.model is populated, but nothing on desktop consumes it for the composer pill. Mobile closes the loop (use-mobile-native-chat-controller.ts passes activeSessionTab?.agentStatus?.model into the hook, and the new fallback keeps it). Desktop's only reported-model ingress is Claude-specific: use-native-chat-session-options.ts computes reportedValues exclusively from readClaudeSessionOptionsFromTerminalScreen, and both of its useEffects bail for agent !== 'claude'. For OMP there is no screen reader, so the desktop pill lists discovered models but its selected value only ever comes from a persisted setting, a user pick, or a typed /model — never the running model. If desktop naming is out of scope, the PR should say so; otherwise agentStatus.model needs a non-Claude path into the surface.
Technical details
# Desktop model pill is not fed by the hook
## Affected sites
- src/renderer/src/components/native-chat/use-native-chat-session-options.ts:116 — `reportedValues` is Claude-only.
- src/renderer/src/components/native-chat/native-chat-pty-session-options.ts:76 — the only reported-value ingress on desktop.
- mobile/src/session/use-mobile-native-chat-controller.ts:246 — mobile passes `agentStatus.model`; no desktop analogue.
## Required outcome
- Confirm whether desktop should reflect the live hook model, and if so wire `agentStatus.model` into the desktop surface; or document desktop as discovery-only.
## Open questions for the human
- Is desktop "show" satisfied by the discovered picker list, with naming-the-running-model being mobile-only for now?ℹ️ Nitpicks
matchNativeChatCatalogModelId's new fallback is gated oncatalog.models.length === 0, so it applies to any future empty-seed catalog, not just OMP. It is fine today (OMP is the only empty-seed catalog), but the "reported value is authoritative" semantics are now the generic default for unseeded agents.modelMetadatais process-scoped and never reset; the "keeps the last known model when a context carries none" behavior is deliberate (and tested), but the same stickiness means a model can briefly leak across an in-process OMP session switch until the first event of the new session carries a model.agentArgsOverrideonly detects--model/--model=; if OMP also accepts a short-mflag, a user-mwould not be recognized and could double-emit. Worth confirming against OMP's actual CLI surface.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Review (pullfrog): the OMP model stamp reached the sidebar rows but never the desktop composer — use-native-chat-session-options only read Claude's terminal frame, so the desktop pill listed discovered models with no selected value. Read the pane's agentStatus.model in the hook (by paneKey, primitive selector) and report it to the surface for non-Claude agents, resolving it against the discovered list when one exists. Only a report that changes is evidence, keyed on the pane scope so a surface rebuild cannot revert a user's pick with the same stale report. Also from the review: reset the extension's cached model when OMP switches sessions in-process, and pin that omp has no -m and that --models is not a model pick.
SudoAI-DEV
left a comment
There was a problem hiding this comment.
Thanks — the desktop gap was real, not intentional. Fixed in the latest commit rather than documented away:
Desktop pill now names the running OMP model. useNativeChatSessionOptions takes the pane key, reads agentStatusByPaneKey[paneKey]?.model with a primitive selector, and for non-Claude agents reports it to the surface (resolved against the discovered list when one exists, otherwise the raw provider/id the unseeded fallback keeps). Claude keeps its terminal-frame path untouched. Same "only a changed report is evidence" guard as mobile, keyed on the pane scope so a surface rebuild for the same pty cannot revert a user's pick with the same stale report. Covered by three new tests in use-native-chat-session-options.test.ts (report before/after discovery, pick stands until the hook reports a different model, Claude ignores the hook value).
Nitpicks:
modelMetadatastickiness across an in-process OMP session switch — agreed, fixed: the extension resets the cached model whenever the session id changes, then re-readsctx.model; the first post of a new session carries no model until the context names one. Test:drops the model when OMP switches to a session that has not reported one.-mshort flag — checked against omp 18.0.8: there is no-m; the only spellings are--model <v>/--model=<v>.--models=(Ctrl+P cycling scope) is a different flag and does not pick a model. Pinned both in the catalog test.- Unseeded-catalog fallback being generic — intentional; the comment on
matchNativeChatCatalogModelIdstates the contract (an empty seed has nothing that could outrank the report). OMP is the only unseeded catalog today.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta against the prior pullfrog review (3f02ae1) fully addresses both raised points: the desktop composer pill now consumes the hook-reported model, and the session-switch stickiness is fixed at the extension source.
- Desktop composer pill now names the running OMP model —
useNativeChatSessionOptionstakes the pane key and readsagentStatusByPaneKey[paneKey]?.modelthrough a primitive selector, resolving it against discovered or catalog models and reporting it to the surface for non-Claude agents; Claude's terminal-frame path is untouched. - Model no longer leaks across an in-process OMP session switch — the extension resets its cached
modelMetadatawhen the session id changes (trackModelSession), so a new session's first posts carry no model until its context names one. - Pinned OMP CLI flag semantics in tests —
--models(Ctrl+P cycling scope) and the nonexistent-mare asserted not to trigger the--modeloverride. - Test-store mocks widened for the new selector — composer and session-options tests now provide
agentStatusByPaneKey, and the desktop dispatch mock is typed against the dispatch contract.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
Superseded by #20612 (OMP model discovery and switching), which contains the current implementation and verification on . Closing this stale duplicate so review stays on the maintained PR. |
|
Superseded by #20612. |

ELI5
In Orca's chat view, Claude Code and Codex sessions have a little "Model" pill in the composer that tells you which model is running and lets you switch. OMP sessions had no pill at all, because Orca never learned which model OMP was using and had no list to offer. This teaches Orca both: OMP now tells Orca its model on every status update, and Orca knows how to launch, switch (
/model provider/id) and, on desktop, discover OMP models.What Changed
Catalog (shared)
src/shared/agent-session-option-catalog-omp.ts(new) + registration inagent-session-option-catalog.ts. No static seed — OMP's selectable models are whatever providers the user configured, so nothing is available on every install and/modelrejects unknown ids.modelApply: launch--model <provider/id>, yields to a user--model/--model=in launch args, mid-session/model <provider/id>(omp resolves the selector exactly, no picker round-trip).discoveredModelsAreAuthoritative.src/shared/omp-model-list-probe.ts(new): parsesomp models --json(selector → id,name→ label, provider → description; dedupes; tolerates an update notice printed before the JSON). Wired as a discovery-only probe spec inagent-model-probe-spec.ts, the same way Grok is, so desktop enrichment fills the picker from the host's real list.native-chat-session-option-state.ts:matchNativeChatCatalogModelIdkeeps the hook-reported selector as the tracked row when the catalog seeds no models (previously an unmatched report was dropped, which would leave OMP's pill empty forever).Hook / extension (main + shared)
src/main/pi/agent-status-extension-source.ts: the extension Orca installs into pi/omp now capturesctx.modelasprovider/idand stampsmodelon every post — only under the OMP runtime (configured/hook/omp, or a Pi-kind install that detects it is running insideomp). Plain Pi posts are unchanged. A throwing model getter is swallowed so status delivery never breaks the run.src/main/pi/agent-status-handler-source.ts: registersmodel_select(OMP runtime only) and posts the newly selected model. OMP does not emit this event today, but Pi's runtime does and OMP wraps it; the every-post stamp is what carries switches in the meantime.src/shared/agent-hook-listener/providers/pi-family-events.ts: passesmodelthroughnormalizeAgentStatusPayload;model_selectre-emits the pane's last known status under the new model instead of inventing a state (null before any status exists).Desktop (added after review)
use-native-chat-session-options.ts: takes the pane key, readsagentStatusByPaneKey[paneKey]?.modelwith a primitive selector, and for non-Claude agents reports it to the surface — resolved against the discovered list when one exists, otherwise the rawprovider/id. Claude's terminal-frame path is untouched. Only a report that changes is evidence, keyed on the pane scope so a surface rebuild for the same pty cannot revert a pick with a stale report.NativeChatComposer.tsxpassespaneKey.Mobile
mobile/src/session/use-mobile-native-chat-session-options.ts: widens the catalog gate fromclaude | codexto includeomp. The existing caveat aboutdefaultModelIsCliDefaultcatalogs (Grok) does not apply — OMP's catalog has no seed and no CLI default; its rows are only ever the hook-reported model.Tests (+ harness
HookContext.model)agent-session-option-catalog-omp.test.ts: probe args/parse, registration, launch args,--modeloverride detection,/modelround-trip.agent-status-extension-omp-model.test.ts: model stamped on every OMP post across the three OMP-runtime detections, follows a context switch, keeps the last known model when a context carries none,model_selectpayload, plain Pi never reports a model, throwing getter survives.server-pi-normalization.test.ts: OMP status carriesmodel;model_selectre-emits last status with the new model; null before any status; Pi posts stay model-less.use-mobile-native-chat-session-options.test.ts: OMP pill appears once the hook reports a model; a pick dispatches/model <selector>and the next changed report confirms it.native-chat-session-option-state.test.ts: unseeded-catalog fallback.use-native-chat-session-options.test.ts(desktop): report before/after discovery; a pick stands until the hook reports a different model; Claude ignores the hook value.-m, and--models=is not a model pick.Why
Two independent gaps kept OMP out of the model pill (analysis in #17603):
CATALOGShad noompentry →getAgentSessionOptionCatalog('omp')wasnull→MobileNativeChatSessionOptionPickers/ desktop pickers rendered nothing.normalizePiCompatibleEventnever producedmodel, and the omp-side extension never posted one →agentStatus.modelwas empty, so even with a catalog the pill could not name the running model. The omp process knows it (ctx.model, and its own status bar shows it).Scope is OMP only, on purpose: Pi has no chat surface yet (#13185), so its posts keep carrying no model; that half of #17603 can build on this once Pi gets a chat view.
Known limit, stated plainly: on mobile the picker lists the reported model (plus anything picked this session) — mobile has no model-discovery RPC today, and OMP has no universal seed. Desktop names the running model from the hook and lists the full set through
omp models --json. Threading OMP's available-model list through the hook (ctx.modelRegistry.getAvailable()/ctx.scopedModels) for mobile is a follow-up I'm happy to send if this shape is accepted.Linked Issue
Part of #17603 (the OMP half; Pi's chat surface is #13185)
Visual Proof
Before (mobile, OMP chat view — composer has no model pill): #17603 (comment)
After: not captured — the extension is installed by the running Orca build and I cannot swap it into the packaged 1.4.192 app without a dev build on the phone. The generated extension source is exercised end-to-end in
agent-status-extension-omp-model.test.ts(transpiled and run in a VM with a fakefetch), and the mobile hook test asserts the pill descriptor and/modeldispatch. I'll add a real screenshot if a maintainer wants one before merge.Testing
vitest runoversrc/shared,src/main/pi,src/main/agent-hooks,src/main/text-generation,mobile/src/session,src/renderer/src/components/native-chat: all green after the review fixes (native-chat 928/928, the rest 7191 passed / 72 skipped).pnpm typecheck: pass.oxlint+oxfmt --checkon all changed files: clean.CLI facts verified locally on omp 18.0.8:
omp models --jsonshape ({models:[{provider,id,selector,name,thinking,…}]}),/model <provider/id>exact match,--model=<value>accepted. Pi 0.84.4 docs confirmctx.model/model_selectshapes.Not done: a packaged-app run on macOS / Windows / Linux / SSH. The change is string-only args plus a JSON field on the hook payload, and goes through the same launch and status paths as the other catalog agents.
I manually tested these changes locally (CLI behaviour verified; no packaged-app run yet)
Automated tests added/updated, or explained why not below
AI Disclosure
Written with Claude Code (Claude Fable 5), reviewed and directed by a human.
Review
Self-review: cross-platform — no path or shell handling; the extension source is the same string on every platform and the JSON probe needs no locale-dependent parsing. SSH/remote — model discovery runs through the existing
discoverRuntimeCommitMessageModelshost path; hook posts already traverse the relay, andhasMatchingTurnIdentityalready comparesmodel. Agents — onlyompgains behaviour;piandprime-agentposts are byte-identical to before (tested). Performance — one extra short string per post;updateModelMetadatais a property read. Security — the model selector is a bounded string (AGENT_MODEL_MAX_LENGTH) normalized like every other status field.Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Backwards compatibility: an older Orca receiving posts from a newer extension simply ignores the extra
modelfield; a newer Orca with an older installed extension shows no pill for OMP, exactly as today.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (typecheck + targeted vitest + oxlint/oxfmt on changed files pass locally; full lint/test/build left to CI)