Repository navigation
refactor(providers): return prepared dynamic models directly - #126574
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Land-ready proof for The async embedded-model resolution lifecycle now owns the exact model returned by Production +89/-253 (net -164); tests +448/-158 (net +290); test support +12/-10 (net +2); docs +6/-4 (net +2). Exact-head local verification: Real exact-head live verification: All isolated services were stopped, temporary proof state was removed, and the clean worktree still points at the reviewed head. Exact-head pull-request CI: https://github.com/openclaw/openclaw/actions/runs/32343492054. ClawSweeper status: exact-head review started; its current comment contains no findings and no published rank-up moves. Required exact-head CI is already green; the asynchronous review publisher is still pending. No merge has been attempted. |
|
Codex review: needs maintainer review before merge. Reviewed August 20, 2026, 3:33 AM ET / 07:33 UTC. ClawSweeper reviewWhat this changesThe branch lets provider plugins return a prepared dynamic model directly, removing shared discovery caches while preserving the existing resolver fallback. Merge readinessKeep open for maintainer review. The patch provides a coherent request-scoped replacement for shared dynamic-model discovery caches, preserves the established void-return fallback, and has focused behavior and live-provider evidence; the public plugin contract remains compatibility-sensitive until exact-head checks finish. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherProvider plugins prepare model metadata that the embedded agent runner uses to select and execute a model. A prepared result now flows directly into the runner; plugins that return nothing continue through the synchronous registry resolver. flowchart LR
A[Provider plugin] --> B[Prepare dynamic model]
B --> C{Prepared model returned?}
C -->|Yes| D[Embedded agent runner]
C -->|No| E[Registry resolver]
E --> D
D --> F[Model execution]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -162, Tests +290, Docs +2. Total +130 across 23 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Merge after exact-head checks confirm the documented void-return fallback remains compatible for existing provider plugins. Do we have a high-confidence way to reproduce the issue? Not applicable: the PR refactors discovery-state flow rather than reporting a standalone current-main failure. Is this the best way to solve the issue? Yes: carrying a request-scoped prepared model through generic runtime code removes cache coupling while retaining the existing resolver contract for plugins that return void. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2a79f747019c. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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.
The request lifecycle now carries its exact prepared dynamic model through the existing override, transport, normalization, and preference pipeline. llama.cpp, LM Studio, and local Ollama no longer need request-bridging provider caches; existing void-returning provider hooks retain their synchronous retry compatibility. |
Related: #126498, #126434, #125781
AI-assisted maintainer-requested refactor.
What Problem This Solves
Asynchronously discovered llama.cpp, LM Studio, and local Ollama models previously had to pass through plugin-global bridging caches before the synchronous resolver could see them. Those caches duplicated request ownership, retained stale discovery results, and made concurrent endpoint, credential-profile, or SecretRef changes harder to keep isolated.
Why This Change Was Made
The asynchronous embedded-model resolution owner now consumes the exact
ProviderRuntimeModelreturned byProviderPlugin.prepareDynamicModeland passes it through the existing configured-model overrides, manifest aliases, transport/header precedence, normalization, and runtime-preference decision path. The public hook changes additively toPromise<ProviderRuntimeModel | void>: existingvoidimplementations still retry their synchronousresolveDynamicModelhooks unchanged.llama.cpp, LM Studio, and local Ollama now return only their requested discovered model directly, deleting their immediate request-bridging maps, scoped snapshots, eviction logic, and Ollama credential-fingerprint bookkeeping. Ollama Cloud/static resolution and existing OpenRouter, ClawRouter, GitHub Copilot, and OpenAI synchronous/void-compatible provider behavior remain unchanged.
User Impact
Operators continue to use the same provider configuration and model-selection commands. Concurrent local-provider model requests now retain their own fresh endpoint and credential-scoped metadata without crossing profiles or relying on stale plugin-global discovery caches. Existing third-party provider plugins that return nothing from
prepareDynamicModelremain compatible.Evidence
Exact diff classification: production +89/-253 (net -164); tests +448/-158 (net +290); test support +12/-10 (net +2); docs +6/-4 (net +2).
Focused provider, embedded-resolution, live-candidate, and legacy-provider compatibility proof: 16 files, 615 tests passed across seven Vitest shards.
Real exact-head provider proof used session-owned isolated loopback services and existing local models; every service and temporary resource was cleaned up afterward: