fix(omo-senpi): builtin model profiles resolve to a custom models.json provider serving the same model id (#10485)
Fixes #10485
Summary
A builtin model profile (Daily · Normal / Heavy, Geeky · Normal / Heavy, and the unset default that walks them) now resolves to a provider the user declared in models.json when that provider serves the exact model id the rung asks for. Before, such a setup (for example an API-key proxy my-claude-proxy serving claude-opus-5-5) reported "no available model" and the session stayed on senpi's default.
Reported by 채완.
Precedence
- The rung's listed built-in providers, in their listed order (unchanged; a subscription login still beats an API key).
- Then providers declared in
<agentDir>/models.jsonwith their ownmodels, in declaration order, on an exact<provider>/<model id>registry match only.
The #9146 protection is unchanged. A gateway the user never declared isn't in that list, and a gateway's re-published copy carries a vendor-prefixed id (opengateway/anthropic/claude-opus-5-5) that never equals the bare id. User-defined profiles behave as before.
Changes
packages/omo-senpi/src/components/model-profile/custom-providers.ts:customModelProviders(agentDir)readsmodels.json(JSONC, as senpi parses it). It lists providers whose entry has a non-emptymodelsarray, in declaration order. An override that only setsbaseUrlor credentials for a built-in provider is not listed.resolve.ts:resolveModelProfiletakescustomProviders. For builtin rungs only,matchProfileRungtries those providers after the listed ones.index.ts: the session-start resolver passescustomModelProviders(agentDir).- Bundles regenerated in linux/amd64 node 24 + bun 1.4.2: only
omo.jschanged.
QA & Evidence
- RED: in
resolve.test.ts, the custom-only and declaration-order cases failed on the pre-fix code (toMatchObject: the result wasunavailableinstead ofresolved).custom-providers.test.tsfailed with the module absent. - GREEN:
bun test packages/omo-senpi/src/components/model-profilegives 114 pass, 0 fail.tsgo --noEmit -p packages/omo-senpi/tsconfig.jsonis clean. - Live Senpi QA (real
senpibinary, throwaway sandbox with HOME, XDG and agent dir inside it, removed afterwards). Setup:models.jsondeclaresmy-claude-proxyservingclaude-opus-5-5(unreachable base URL, dummy key), andomo.jsonsetsmodel_profile: daily-normal.- dev bundle:
omo-model-profile:unavailable, "daily-normal (Daily · Normal) has no available model". - this branch:
omo-model-profile:applied, "daily-normal (Daily · Normal) selected my-claude-proxy/claude-opus-5-5 medium", plus an extension-sourcedmodel_changeto that model.
- dev bundle:
- Bundles:
build-extension.mjs --checkandbuild-install.mjs --checkexit 0 after the regen. - Full suite: Boat run at the head is in progress; results will be posted here.
Evidence files are local under .omo/evidence/omo-senpi-adapter/20261018-profile-custom-provider/ (SUMMARY.md, base.*, head.*).
Follow-up
senpi-task category chains filter providers the same way. Whether categories should also honor declared custom providers is a separate decision.
Summary by cubic
A builtin model profile (Daily/Geeky Normal/Heavy) now resolves to a provider the user declared in models.json when that provider serves the exact model id the rung asks for. Previously such setups reported "no available model" and stayed on the default profile.
- Custom
models.jsonproviders are tried after the rung's listed providers, in declaration order, only on an exact<provider>/<model id>match. An override that only setsbaseUrlor credentials for a built-in provider isn't listed. - The #9146 protection is unchanged: an undeclared gateway isn't listed, a gateway's re-published copy carries a vendor-prefixed id (
opengateway/anthropic/claude-opus-5-5), and a gateway declared only with unrelated models still doesn't serve the rung's id. models.jsonis now parsed once per process while the file is unchanged (keyed on mtime and size), shared by the custom-provider and credential-rotation readers; an edited file is picked up at the next session start.- Bundles and CHANGELOG regenerated;
bun test packages/omo-senpi/src/components/model-profilepasses 114 tests.