Repository navigation
fix: prevent stale fallback models after plugin reloads - #133633
Conversation
|
🦞👀 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 7, 2026, 11:43 PM ET / September 8, 2026, 03:43 UTC. ClawSweeper reviewWhat this changesThe PR separates cached fallback model lists by plugin registry and metadata view, preserves caller-owned copies, and adds reload regression coverage. Merge readiness✅ Ready for maintainer review The narrowed repair remains necessary on current main. No actionable defect was found, and the previous draft-status blocker is resolved. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw builds an ordered model list from the requested model and configured fallbacks. Plugin metadata and provider hooks normalize those choices before the fallback runner attempts them. flowchart TD
A[Requested model and configured fallbacks] --> D[Fallback candidate cache]
B[Selected plugin registry] --> D
C[Selected metadata view] --> D
D --> E[Ordered independent candidate list]
E --> F[Model fallback runner]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +5, Tests +107. Total +112 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep fallback caching bounded and tied to the exact registry and metadata view already selected for the operation. Do we have a high-confidence way to reproduce the issue? Yes, from source: identical configuration and metadata fingerprints can reuse generation A's cached models under generation B or a narrowed view. The added regression captures that sequence; this review did not execute it. Is this the best way to solve the issue? Yes. Adding the missing context identities at the cache owner preserves existing normalization precedence, candidate ordering, copy isolation, and the 256-entry bound without adding a competing selection path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2da0ae724dae. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
|
Maintainer review of the packaged-path finding on The proposed The full declaration-enabled build and built SDK cold/warm normalization assertions passed at this head. The cold assertion requires The one-line changelog entry is retained by explicit maintainer direction. The +38 production lines separate retained lookup from cold loading and share matching/evaluation; duplicate probes, matching logic, and cached hook misses were removed. Hosted CI run 33343257890 is still failing. Its source-loader/test failures are being investigated independently; this comment is not a merge-ready claim or a waiver of CI. |
a27f0eb to
e7cabfd
Compare
d847db0 to
63be397
Compare
Read the replacement runtime configuration, authored activation source and metadata together when deferred startup logging begins. Remove redundant one-shot plugin-load memoization while retaining load, claim, retirement and attachment ordering. Related: openclaw#130706, openclaw#133633.
|
Merged via squash.
|
) Bind the bounded fallback candidate cache to both the selected provider registry and exact metadata view. Preserve caller-owned copies and remove redundant collector typing and clone plumbing. Related: openclaw#130706, openclaw#133633. No claim of CPU workload recovery for openclaw#130324.
Related: #130706, #130324. CPU/stall recovery for #130324 remains unproven by this repair.
What Problem This Solves
Resolves a problem where model fallback could select a model normalized by another provider generation after a plugin reload. A narrowed metadata view could also keep applying model aliases from a broader view.
Why This Change Was Made
Fallback candidate reuse now distinguishes both the selected runtime registry and the exact metadata view. Weak identity tokens keep the existing global 256-entry bound without retaining retired contexts, and callers receive independent copies of cached candidates.
This narrows the former umbrella change to the remaining two-file cache repair. Provider hook and alias ownership landed separately in #141679, and admitted compaction generation selection landed in #139429. Related SDK and model-selection fixture cleanup landed in #139829, #139900, and #140069; the wider extraction remains tracked in #130706.
User Impact
Fallback uses the provider implementation and manifest rules selected for that run, even when multiple generations coexist. Empty registries and narrowed metadata views remain authoritative, and one caller cannot change another caller's cached model or route provenance.
The production change is +5 lines after removing redundant collector typing and copy-helper plumbing. The regression file adds 107 lines covering three cases. This remains an in-memory cache repair with no configuration, persistent-store, or protocol change.
Evidence
Before the fix, warming generation A made both retained-generation and request-scoped B return
model-ainstead ofmodel-b. A shared empty registry with full→narrow metadata returnedmodel-fullinstead oflatest. The unfixed source is identical on the current main base.On main
665d4fadbd475a4117dc90696ae2da1037afdb3c, the cache regression and two normalization sibling files passed 28 tests. They cover A→B→empty→A→A, active-scope restoration, full→narrow→full metadata, and mutation isolation for model and route fields.An isolated synthetic source run through
runWithModelFallbackattempted the expected A/B/empty/A fallback models after each primary failure. This is source-boundary proof, not a package, Gateway, or authenticated-provider result.The prior full changed gate and managed P2 scoped-clean review carry forward by exact equivalence: both file operations and postimages, all 33 reviewed context files, and 21 additional dependency/tooling/owner files are byte-identical. Current-main targeted lint, formatting, and diff checks passed. Required CI must be assessed on the rewritten PR head.
Blacksmith Testbox runtime proof built exact published head
63be3978bdaf3941ddf3b367c4624ed4e21da739. Both compiled cache scenarios passed: retained registries A→B→empty→A and metadata full→narrow→full. Across seven contexts, the real fallback runner made all 14 expected primary/fallback attempts; caller-copy isolation and route provenance remained intact. All six production functions came from that natural build. Both process groups settled without escalation, fixtures were removed, source/runtime manifests stayed unchanged, and all 81 exported files were hash-verified.This is compiled production-boundary proof with synthetic provider callbacks. It does not establish Gateway, external-provider, or CPU/stall recovery. Exact-head CI and native landing remain pending.
Contributor credit remains Peter Steinberger (@steipete).