Repository navigation
fix(plugins): retire model-catalog scratch captures with their run - #155159
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 21, 2026, 4:22 PM ET / 20:22 UTC. ClawSweeper reviewWhat this changesModel-catalog discovery reuses an already-loaded plugin’s captured files and refreshes callbacks when its runtime changes, with regression coverage and cleanup documentation. Merge readiness✅ Ready for maintainer review Keep open: this is a focused, useful repair that fetched main still lacks. The ownership checks and successor-callback refresh are coherent, and no introduced correctness or security defect was found. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw builds its model catalog from plugin metadata and provider discovery callbacks. External plugins run from captured package files, whose lifetime must follow the runtime that owns them. flowchart TD
A[Plugin metadata] --> B[Provider discovery]
C[Selected runtime registry] --> B
B --> D{Matching loaded owner?}
D -->|Yes| E[Reuse runtime capture]
D -->|No| F[Separate setup lifetime]
E --> G[Model catalog and auth facts]
F --> G
E --> H[Retire with runtime owner]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +22, Tests +345, Docs +19. Total +386 across 9 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep discovery source and callbacks under the selected runtime’s existing lifetime while preserving standalone setup ownership and safe legacy cleanup. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the duplicate setup capture and stale callback reuse, and the PR records failing-before/passing-after regressions. This read-only review did not independently execute them. Is this the best way to solve the issue? Yes: reusing the existing instance loader and rebuilding callbacks only when registry identity changes repairs the ownership boundary without new configuration, storage, or cleanup machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a7c27c04a3d6. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
Related: #154571 and #154973. Thanks @mulderp82 and @podulator for the reports and nested-directory measurements.
What Problem This Solves
Model-catalog discovery makes a second complete source capture for an external plugin whose runtime is already loaded, increasing the size of its worker scratch tree.
User Impact
Catalog discovery reuses the selected runtime's captured package and lifetime. Repeated refreshes keep one capture per plugin, and discovery callbacks cannot outlive their runtime owner. Standalone discovery keeps its existing setup lifetime. No configuration, dependency, or SQLite schema changes.
Why This Change Was Made
The provider-discovery loader now uses the existing public-surface loader only when the selected generation and current context identify the same loaded runtime owner. Derived catalog preparation refreshes discovery callbacks when its runtime registry changes, so releasing a predecessor cannot poison successor auth refreshes.
Current main already has the SQLite ownership and worker-retirement fixes that postdate 2026.9.5: cleanup after confirmed worker exit, abandoned-owner startup reclamation, CLI-exit disposal, and Doctor removal of complete legacy catalog trees. This change preserves those owners and strengthens nested-tree coverage.
idleTimeoutMs: 0keeps an active inventory warm; it does not disable explicit close. No fd/map or age-only liveness heuristic is introduced.Evidence
The same Testbox fixture used two external plugins, each with a 1 MiB payload, across four agents and repeated catalog/auth refreshes. Sizes count regular files without following host-package symlinks.
expected 4 to be 2, then passed after the fix. Test time 2.086 s; runner wall 19.53 s. The existing pool case was moved into a focused file and extended, preserving its source-version and per-agent auth-isolation assertions.PluginInstanceUnavailableErrorafter predecessor retirement, then passed with refreshed successor callbacks (840 ms test; 30.61 s runner wall). Exact-source and distinct-registry fallback cases passed in 87 ms (29.75 s wall).pnpm buildpassed in 6m 54.4s. All selectedcheck:changedsteps passed: after fixing a redundant assertion and two test lint issues, the exact failed lint and remaining guards were resumed through the repository command owners; nothing was skipped.tbx_01m32kaajm9jgbt56vrw9d6pv1(run).Production +34/-12 (net +22); tests +450/-105 (net +345, including the moved pool case); docs +20/-1.
A documentation conflict with the already-landed ClickClack troubleshooting entry was resolved by retaining both sections. Production/test blobs are unchanged by that rebase.