fix(models): stop flagging built-in models as custom in /v1/models (base-red) - #10388
fix(models): stop flagging built-in models as custom in /v1/models (base-red)#10388diegosouzapw wants to merge 1 commit into
Conversation
PR #10248 rewrote the custom-model overlay merge to always write `custom: true`, even when the custom row is only a metadata overlay on a model already present in the catalog as built-in/synced (e.g. a token-limit override on openai/gpt-4o-2024-11-20). That misclassified built-in models as operator-defined in the public catalog response. Drop the hardcoded `custom: true` from the overlay so `existing.custom` is preserved: a row that already was custom stays custom, a built-in merely overlaid with custom metadata stays built-in. Restores the pre-existing contract asserted by tests/unit/models-catalog-route.test.ts, which has been red on the release tip and was failing every open PR's Unit Tests shard. Refs #9985
|
Superseded by #10383 ( Both PRs diagnosed the same red ( The maintainer decision is the one already on the branch, so this PR is closed without merging — no code change is needed. Verified: the release tip now passes that test, and the failure is gone from the open PRs once they merge the current base. |
…#9985) (#10396) `check:dead-code` reports 410 dead symbols against a 409 baseline on the pristine `release/v3.8.50` tip, so every PR on the branch is born red on that gate (#10386, #10393, #10390, #10388, #10382 all fail it). Isolated the +1 by diffing knip 6.32 reports between the rebaseline commit 97aac6a (409) and the tip (410): `resolveOpencodeConfigDir` in `src/shared/services/cliRuntime.ts`. #10246 moved the canonical resolvers into `opencodeConfigPath.ts` and left this wrapper behind; the same commit removed its last consumer. The wrapper was not just unused, it was divergent: it returned `path.dirname()` of the canonical value — `~/.config` rather than `~/.config/opencode` — so any future caller reaching for it by name would have written the OpenCode config one directory too high. Removed the wrapper and its now-unused import. A new test pins the canonical resolver's contract and asserts the divergent re-export stays gone; the guard was mutation-validated (re-adding the wrapper fails it). check:dead-code: 409 = baseline, PASS. cliRuntime/opencode suites: 51 pass, 0 fail. New guard: 3 pass, 0 fail. lint / typecheck:core / file-size / complexity-ratchets / test-discovery: green. Co-authored-by: Xiangzhe <bakryun0718@proton.me>
Summary
Base-red fix for
release/v3.8.50(#9985):tests/unit/models-catalog-route.test.tshas been failing on the release tip, taking down the Unit Tests fast-path shard of every open PR — including third-party ones.Root cause: #10248 rewrote the custom-model overlay merge in
src/app/api/v1/models/catalog.tsto always writecustom: true. That is correct when the custom row is the model, but wrong when it is only a metadata overlay on a model already present as built-in/synced (e.g. a token-limit override onopenai/gpt-4o-2024-11-20) — those got reported as operator-defined in the public/v1/modelsresponse.Fix: drop the hardcoded
custom: truefrom the overlay object soexisting.customsurvives the merge. A row that already was custom stays custom; a built-in merely overlaid with custom metadata stays built-in. One file, ~12 lines including the explanatory comment.Validation
tests/unit/models-catalog-route.test.ts— 44/44 (was 43/44 red on the tip).getUnifiedModelsResponse/addCustomModel— 388/388.check-open-sse-typecheck.mjsOK ·typecheck:coreexit 0 · prettier/eslint clean on the touched file.The originating investigation started from a different hypothesis (inactive-provider leakage); instrumentation proved the
activeAliasesgate already works and pointed at thecustomflag instead.Refs #9985, #10248