Repository navigation
fix(agents): normalize bare model defaults with captured metadata - #144429
Conversation
Let unresolved bare defaults with captured plugin metadata reach the existing model-reference parser. Preserve the cheap raw return when metadata is absent, reuse the cached context, and keep already selected refs off a second pass. This repairs invalid simple-completion overrides falling back to an unnormalized model ID marked selected. Cover one-pass aliases, metadata scope, normalization flags, auth-profile parsing, configured API ownership, and agent acquisition.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 10, 2026, 5:49 PM ET / 21:49 UTC. ClawSweeper reviewWhat this changesThe PR makes providerless default models use already-captured provider normalization rules and adds regression coverage for selection and completion acquisition. Merge readiness✅ Ready for maintainer review This remains a useful, focused fix: current main and v2026.9.3 retain the raw fallback that bypasses captured normalization. No actionable introduced defect was found, and the related TTS work explicitly depends on this correction. Priority: P2 Review scores
Verification
How this fits togetherModel selection converts configured names and provider metadata into the provider/model pair used by agent completions. Preparation then consumes that selected identity to obtain model metadata, credentials, and transport resources. flowchart TD
A[Configured default model] --> B[Alias and provider resolution]
C[Captured provider metadata] --> B
B --> D{Unresolved bare name}
D -->|Metadata available| E[Existing model parser]
D -->|Metadata absent| F[Preserved raw fallback]
E --> G[Selected model preparation]
F --> G
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +212. Total +214 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep normalization in the shared parser so captured defaults yield one selected identity without adding discovery, configuration, or a competing resolver. Do we have a high-confidence way to reproduce the issue? Yes, from source: an unresolved bare primary with captured alias metadata returns raw on current main, and an invalid completion override can consume that fallback as already selected. No runtime reproduction was executed in this review. Is this the best way to solve the issue? Yes. Letting that branch reach the existing parser is a narrow repair that preserves cached metadata, normalization controls, and earlier resolved selections. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8e9e753e7b70. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Capture provider metadata before selecting global TTS summary overrides and defaults, and share lightweight completion acquisition so selected aliases normalize once. Preserve the shipped injected callback and its caller-owned returned model. Reject malformed slash references before exact default-provider lookup, keeping invalid summary overrides on the global default. Cover bare defaults without configured aliases or model rows on the landed captured-default owner repair. Related: #130706 Prerequisite: #144429
Capture provider metadata before selecting global TTS summary overrides and defaults, and share lightweight completion acquisition so selected aliases normalize once. Preserve the shipped injected callback and its caller-owned returned model. Reject malformed slash references before exact default-provider lookup, keeping invalid summary overrides on the global default. Cover bare defaults without configured aliases or model rows on the landed captured-default owner repair. Related: #130706 Prerequisite: #144429
Let unresolved bare defaults with captured plugin metadata reach the existing model-reference parser. Preserve the cheap raw return when metadata is absent, reuse the cached context, and keep already selected refs off a second pass. This repairs invalid simple-completion overrides falling back to an unnormalized model ID marked selected. Cover one-pass aliases, metadata scope, normalization flags, auth-profile parsing, configured API ownership, and agent acquisition.
Capture provider metadata before selecting global TTS summary overrides and defaults, and share lightweight completion acquisition so selected aliases normalize once. Preserve the shipped injected callback and its caller-owned returned model. Reject malformed slash references before exact default-provider lookup, keeping invalid summary overrides on the global default. Cover bare defaults without configured aliases or model rows on the landed captured-default owner repair. Related: openclaw#130706 Prerequisite: openclaw#144429
Related: #130706. Prerequisite for the bare-default cases held in #144354 and CLI model validation.
What Problem This Solves
Fixes an issue where a simple completion falling back to a bare configured primary could reject the model or use the wrong metadata, despite already having the provider's normalization policy. For
entry → middle → final, the fallback could retain rawentrywhile later preparation treated it as fully selected.Why This Change Was Made
Captured bare defaults now continue through the existing model-reference parser. It reuses cached metadata, normalization flags, auth-profile parsing and configured API-owner handling. Callers without captured metadata keep the existing cheap raw path; already resolved branches return before this point. The production change is two added lines.
User Impact
Default fallback selection uses the provider's intended model without resolving an already-selected alias twice. No configuration, schema, persisted fields, imports, or public API options are added, and this change introduces no new metadata discovery.
Evidence
Validated
62675418c10dc22d7f1b673c3b20145543c3acf3against mainf9976d6de6a086c3b19edbfaeb7412db47b50bb7.Two earlier compiled fixture attempts remain failed and preserved: an explicit configured API mapping treated
/as a literal ID, and a disabled canonical provider owner prevented the synthetic plugin from loading. The final fixture verifies the invalid-override precondition and enables its isolated synthetic provider replacement. Source and build were unchanged between attempts. This is compiled SDK/loopback proof, not external vendor inference; it does not borrow the unlanded TTS patch.