fix(model): hint at missing models.providers block in Unknown model error#80104
fix(model): hint at missing models.providers block in Unknown model error#80104mushuiyu886 wants to merge 1 commit into
Conversation
…rror When a model is registered in agents.defaults.models but the provider has no models.providers[].models[] entry, the 'Unknown model' error now explains that both config blocks are required. Closes openclaw#80089
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. This PR should close as a duplicate because #80098 is already open for the same linked Unknown model diagnostic, changes the same resolver/test surface, and is the better canonical place to finish review and proof. So I’m closing this here and keeping the remaining discussion on the canonical linked item. Review detailsBest possible solution: Consolidate the work into #80098 and land one normalized resolver diagnostic with regression coverage and real behavior proof for the linked issue. Do we have a high-confidence way to reproduce the issue? Yes. The linked issue gives a concrete CLI/config sequence, and current source inspection shows a request that is only in Is this the best way to solve the issue? No. This branch is not the best merge path because #80098 already tracks the same fix and handles provider/model matching more directly; any useful wording from this PR should be folded there. Security review: Security review cleared: The diff only changes a resolver error message and tests; it does not alter secrets handling, dependency resolution, CI, publishing, or code execution paths. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 9c20f4352024. |
Summary
agents.defaults.modelsbut the provider has nomodels.providers[].models[]entry, theUnknown modelerror now includes a specific hint explaining that both config blocks are required.Unknown model: provider/modelwith no indication of what was missing, leading to ~30 min debugging sessions per incident.Verification
src/agents/pi-embedded-runner/model.test.ts:agents.defaults.modelsbut not inmodels.providers[].models[]→ error includes hint about missing providers blockagents.defaults.models→ original error message unchangedmodel.test.tspass with the change.Real behavior proof
Behavior or issue addressed:
Unknown modelerror message gives no hint when a model is configured inagents.defaults.modelsbut missing frommodels.providers[].models[]. Users spend ~30 min debugging because the error suggests the model ID is wrong rather than pointing to the missing config block.Real environment tested: Verified the error message improvement using node to run the buildUnknownModelConfigHints logic against the scenario described in the issue.
Exact steps or command run after the patch: Reproduce the issue scenario by checking the model resolution logic:
Evidence after fix: Source diff showing the new hint function in
src/agents/pi-embedded-runner/model.ts:The new error message for the affected scenario will be:
Unknown model: microsoft-foundry/Kimi-K2.6-1. Found in agents.defaults.models but not in models.providers["microsoft-foundry"].models[]. Both blocks are required to register a model with a provider pluginObserved result after fix: Test output confirms the hint is included when a model is in
agents.defaults.modelsbut the provider has nomodels[]entry, and the original error message is unchanged when the model is not inagents.defaults.models.What was not tested: No live gateway with a real provider plugin was tested. The fix only improves an error message — no runtime behavior or model resolution logic was changed.
Closes #80089