Repository navigation
refactor(models): consolidate config normalization - #130439
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 5:58 PM ET / 21:58 UTC. ClawSweeper reviewWhat this changesThe branch moves existing model-selection and provider-catalog normalization into shared config helpers while preserving canonical references, defaulting, and secret-marker handling. Merge readinessNo blocking correctness finding was identified. This maintainer-owned refactor is not implemented on current main and should remain open for its exact-head checks to finish. Priority: P3 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherCLI and Gateway config writes normalize model references before validation and persistence, while provider catalogs are normalized before model defaults and agent selection consume them. The change consolidates those preparation steps without adding a new user-facing configuration surface. flowchart LR
A[CLI and Gateway config writes] --> B[Model reference normalization]
C[Provider catalog rows] --> D[Provider catalog normalization]
B --> E[Canonical config and defaults]
D --> E
E --> F[Agent model selection]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -103, Tests +15, Other 0. Total -88 across 7 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one canonical model-selection normalizer at the config-input owner and one identity-based provider normalization flow, then land after exact-head validation confirms preserved config behavior. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor, and the relevant evidence is preservation of existing config normalization behavior rather than reproduction of a defect. Is this the best way to solve the issue? Yes. Moving the duplicate selection logic to the existing config-input owner lets CLI mutation, Gateway validation, and runtime defaults use one canonical implementation without adding a parallel path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 99a2434f7b89. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
* origin/main: (275 commits) fix(ai): require explicit compatible-provider endpoints (#130453) test(control-ui): guard the hand-mirrored theme --bg copies (#130444) fix(onboard): preserve the saved skills package manager (#130438) improve(worker): diagnose admission-deadline failures and widen daemon revalidation budget (#130435) fix(plugins): align diffs external install metadata (#130362) refactor(models): consolidate config normalization (#130439) fix(browser): accept common keyboard aliases (#130401) fix(release): refresh IMAP plugin baselines (#130351) fix(tests): type sticky model agent fixtures (#130441) fix(qa): track current Slack progress cards (#130354) feat(ui): refine the mobile composer (#130308) fix(ui): clarify gateway disconnect status in tab title (#130364) test(qa): await gateway startup before network probes (#130353) fix(qa): run Buzz profile scenarios with pooled credentials (#130316) fix(crabbox): keep the setup failure reason and name its phase (#130425) fix: dashboard tools target the wrong Gateway after admission (#130112) fix(ui): distinguish inherited model defaults from session pins (#120805) feat(feishu): let agents resend received stickers (#130374) refactor(models): prepare selection policy once (#130413) fix(ui): make dashboard side panels enter split view (#130426) ... # Conflicts: # test/scripts/docker-build-helper.test.ts
What Problem This Solves
Model config edits and runtime defaults each implement the same primary/fallback normalization. Provider catalog materialization also repeats change tracking around every normalization stage, while merge/default code duplicates the shared positive-number contract.
Why This Change Was Made
Move model-value normalization to the existing config input owner and use it from both callers. Keep their different field traversals unchanged. Use returned object identity for provider change tracking, and reuse the existing positive-finite-number helper for sizing values. Consolidate default-row change detection without changing authored-field precedence.
Production: +93/-196 (net -103). Tests: +17/-2 (net +15). The assertion baseline shrinks by one deleted assertion. No dependencies, config keys, defaults, migration, persistence format, or public SDK entrypoints are added or removed.
User Impact
No intended behavior change. Existing Google/Together ref canonicalization, fallback order, custom fields, duplicate-row precedence, partial-cost completion, provider key collisions and credential-marker handling remain intact. Authored capabilities and sizing still win; frozen catalog metadata is still cloned before defaulting.
Release context: internal model-config cleanup following the catalog/policy simplifications in #130381 and #130413. No operator action required.
Evidence
config get agents.defaults.model --jsonmatches its before-edit baseline. A real primary-model write/readback persists the canonical target, preserves untouched fallback source text, and materializes canonical ordered fallbacks on read. Initial probes correctly returnedNo changefor an equivalent value and rejected unknown models; the write probe then used explicit local catalog rows with plugins disabled.3a830ccb3ca02264c142c05762359027094868c8.Focused proof commands:
No provider request transport or live Gateway is modified. Operator proof uses synthetic configuration and isolated state. The storage writer is unchanged; only the preparation flow is simplified.
Follow-up candidate: consolidate remaining MiniMax/provider-manifest model builders in a separate change. Any provider capability restoration needs its own authenticated provider proof.
Post-merge combined proof on main
39454997b4497b861bd2fa2fe412434b8282c188: fresh full build/postbuild and 218 tests across six catalog/selection/config files passed. Rebuilt CLI config and per-agent policy outputs match their saved baselines.models list --all --provider zai --jsonstill reportszai/glm-5.3-flashwith text+image input, context window 1048576 and missing=false. All smoke state was isolated; no live Gateway or provider credential changes.