Repository navigation
fix: keep plugin catalogs intact after discovery timeouts - #140441
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 6, 2026, 5:42 PM ET / 21:42 UTC. ClawSweeper reviewWhat this changesPrevent expired model-discovery runs from consuming plugin-owned catalog results, with regression coverage and documentation of late-result handling. Merge readiness✅ Ready for maintainer review This remains a useful, bounded fix: current main still consumes late plugin results at both identified boundaries. No actionable correctness or security findings remain, and the supplied Gateway comparison supports the repair. Priority: P2 Review scores
Verification
How this fits togetherModel discovery combines plugin catalogs with configured providers to build OpenClaw’s model inventory. Its timeout owner must discard expired results without consuming data that a later discovery can use. flowchart TD
A[Model refresh request] --> B[Prepare provider credentials]
B --> C[Run plugin catalog hook]
C --> D{Discovery still active?}
D -->|Yes| E[Read outcomes and finalize catalog]
E --> F[Publish model inventory]
D -->|No| G[Discard result without reading getters]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +7, Tests +162, Docs +4. Total +173 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep result consumption within the existing discovery lifetime while allowing already-admitted credential refreshes to complete safely. Do we have a high-confidence way to reproduce the issue? Yes: current-main source exposes both late getter reads, and the supplied baseline Gateway comparison reproduces the subsequent empty catalog. This read-only review did not execute the scenario. Is this the best way to solve the issue? Yes: checking the existing lifetime before each post-await consumer fixes the cause without changing plugin callbacks, timeout policy, or credential persistence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7921ec48f82d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Fixed: timed-out catalog runs no longer consume provider results needed by subsequent discovery. |
* commit '294df333c58f2da104eccffc623ccb3c4d43d4d8': (1802 commits) fix: clear stale diagnostics after Gateway changes (#140426) fix: keep plugin catalogs intact after discovery timeouts (#140441) perf(tui): prepare session picker rows once per overlay (#140462) refactor(config): reuse environment substitution for write-back (#140460) refactor(discord): remove retired auto-presence templates (#140463) fix(ui): finish roster refreshes during session activity (#140459) fix(setup): match prepared credentials to the model provider (#140461) fix: keep MiniMax discovery on the selected credential (#140438) refactor(tests): remove unused parent context cache reset (#140456) fix: avoid repeated xAI OAuth refresh during discovery (#140434) perf(routing): reuse prepared event session targets (#140454) fix(media): keep deferred audio and extraction providers discoverable (#139231) refactor(codex): remove redundant app-server forwarding (#140451) fix(test): avoid false native polling timeouts (#140119) test(gateway): retain saved source in reload fixtures (#140453) fix(gateway): reduce repeated model work when listing sessions (#140414) fix(feishu): fall back to post mode over table limit (#136382) fix: use the bundle-compatible Proxyline runtime under Bun (#140411) refactor(trace): reuse the canonical usage counter type (#140444) refactor(node-host): share execution policy result fields (#140446) ...
…40441) Discard provider catalog results after their discovery run expires, preserving subsequent refreshes and existing credential-refresh persistence.
Related: #139951
What Problem This Solves
Fixes an issue where a later model discovery could lose catalog data when a plugin returned a stateful result after an earlier discovery deadline. After failed OAuth preparation, host finalization could still consume an abandoned provider result; outcome getters were also read after the hook returned late.
Why This Change Was Made
Carry the catalog owner's existing activity check to the first reader after the awaited hook, and recheck it before finalization. This covers
provider,providers, andoutcomeswithout changing plugin-facing callbacks or cancelling an admitted hook or credential refresh.User Impact
Timed-out discovery no longer drains plugin-owned results before a later accepted discovery. Timely results, multi-provider outcomes, and credential rotation completion keep their existing behavior. The regression is reproduced with a supported synthetic plugin; no affected bundled plugin has been identified.
Evidence
resolveImplicitProviderscomposition: the unfixed path consumed a stateful getter after timeout and left the next discovery empty. The fixed path leaves all three result shapes unread after timeout and consumes them once on the next accepted call.deae51804cfe4a1a57fb87af08ac02be4897d0b9, 94 affected tests passed remotely in 72.07 seconds, including the six lifecycle cases, multiple-provider outcomes, failure retention, successful-empty recovery, and admitted credential refresh persistence. Both CI planner regressions also passed, with the existing 80-job limit unchanged.gateway call models.listrequests per arm: refresh through the deadline, a prepared read after releasing the held hook, and a second refresh. Both revisions used isolated synthetic state, the same plugin, and the same request sequence.e1c1bc37c77deae51804cfprovidergetter readsoutcomesgetter readsThe fixture deliberately fails OAuth preparation, so inventory recovery does not imply executable credentials. Both Gateway processes, temporary state, and local fixture servers were cleaned up. The final remote test/type/build/command sequence exited successfully in 4 minutes 38 seconds.
Exact-head CI passed. ClawSweeper reviewed the same head at Platinum with no findings.
The reproduced contract is inside a custom plugin hook; there is no identified bundled-plugin UI reproduction. Browser fixtures containing already-serialized catalog rows cannot exercise its getters. The real Gateway/CLI comparison is the primary runtime evidence for this lifecycle boundary.