Repository navigation
perf(plugins): consolidate provider discovery planning - #133097
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 1:45 AM ET / 05:45 UTC. ClawSweeper reviewWhat this changesThe PR consolidates manifest-catalog planning and, after a discovery entry fails, reloads selected or credentialed provider owners through the scoped full plugin loader. Merge readinessNo blocking code finding. Keep this member-authored, maintainer-labelled PR open: it repairs a real owner-boundary omission that current main still retains, while exact-head validation must confirm the deliberately changed runtime-loading fallback. Priority: P2 Review scores
Verification
How this fits togetherPlugin manifests provide lightweight catalog metadata to provider discovery before full plugin runtime activation. The resolver supplies ordered provider registrations to model configuration and startup catalog flows. flowchart LR
A[Plugin manifests] --> B[Catalog planning]
B --> C[Discovery entry loading]
C --> D{Entry loading succeeds?}
D -->|Yes| E[Provider registrations]
D -->|No| F[Scoped full plugin loader]
F --> E
E --> G[Model configuration and startup]
Decision needed
Why: The code repair is localized and source-supported, but the changed failure path intentionally crosses from lightweight discovery to runtime loading and needs maintainer acceptance of that compatibility tradeoff. Before merge
Agent review detailsSecurityNone. PR surfaceSource -79, Tests +58, Docs +1. Total -20 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Retain the single manifest-planning flow and scoped fallback, then validate selected, credential-bounded unscoped, static, runtime, and refreshable failure cases on the exact PR head before merge. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: make one provider-discovery entry throw amid selected or credentialed owners; the merge-base catch retained their coverage despite discarding their results. The new focused table test encodes that scenario, but it was not executed in this read-only review. Is this the best way to solve the issue? Yes. The patch repairs coverage at the provider-discovery owner and delegates recovery to the existing scoped loader, rather than adding a consumer retry or a parallel loader path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7bd0903f7a23. LabelsLabel justifications:
EvidenceWhat 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
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* perf(plugins): consolidate provider discovery planning * test(plugins): construct discovery scenarios directly * test(memory-core): assert lease ordering after both readers finish * docs: keep provider release note with the PR
What Problem This Solves
Provider discovery planned each effective manifest catalog twice, repeating overlay lookup, normalization, sorting and provider construction. Its outer resolver also repeated full-loader scope selection and dispatch.
The same owner could silently omit providers after a discovery entry failed: it discarded all executable entry results but still marked their owners covered. A retained static catalog then prevented the selected or credentialed discarded owners from reaching canonical registration. A direct full-registration control proves their full modules can recover.
Why This Change Was Made
Prepare static providers and runtime-owner IDs together from one effective catalog plan per selected plugin. Carry those facts into one full-loader decision. Delete three private scope wrappers, a single-use filter wrapper, an unused result field and repeated result assembly. Existing metadata, catalog planner and plugin loader remain the owners; no new cache or freshness mechanism.
At the existing all-or-nothing catch, retain only independently valid manifest coverage. The existing scoped loader can then recover discarded executable entries. Static-only owners remain covered even if their optional entry fails; mixed runtime/refreshable owners still load and replace their static descriptors. Successful empty exports retain their existing meaning. This repair adds no production lines to the refactor.
User Impact
Less repeated work in provider discovery, and missing providers recover after a sibling discovery failure. Explicit selection, registration ordering, synthetic auth, input ownership and entries-only behavior remain intact. Selective partial-coverage discovery remains credential-bounded when unscoped; the pre-existing all-empty/no-runtime path still delegates to the ordinary full loader unchanged. No configuration, schema, SDK or protocol change. Release-note context is included below for the release-owned changelog.
One failure-path timing change is deliberate: duplicate planning could incidentally retry a caught local overlay-read failure within the same invocation. One preparation uses the manifest row for that invocation; the unchanged overlay owner clears its failed cache and retries on the next invocation. Recovered content is identical. There is no new retry, network refresh policy or persistent-state change; the failing invocation is not claimed to return identical content.
Evidence
76bdb3566dab1439aa97eaa9ad5cc7e449995dc1: 1,280 cases, with 1,125 unchanged and 155 repaired omissions, plus nine unique direct registration controls. Covers failure first/middle/last, partial/discarded entries, explicit empty and unscoped requests, independent credentials, static/runtime/refreshable and mixed owners, same-owner static plus failed entry, and successful empty/invalid exports. Unchanged cases retain ordered payload equality; repaired cases use an independent scope/ownership oracle. All observations match the original evidence; 52 root inputs (including six tests) and 87 installed loader-package files stayed unchanged. No lightweight retry is introduced. This addresses ClawSweeper's requested exact-head real-loader rank-up proof.Two fresh final-source benchmark processes used opposite starting orders, seven alternating samples per workload, and all raw samples. Imports, fixture preparation, warmup and calibration were outside timing; complete uninstrumented owners used the actual planner and normalizer. All 20 recorded source/dependency/package hashes stayed unchanged.
That is 1.50–1.87× across these fixtures, with more variability in the smallest case. The separate final-source overlay probe also passes, including the disclosed next-invocation recovery. These measurements exclude cold startup, discovery-entry/full-runtime loading, network/model latency and memory behavior; no universal latency or memory improvement is claimed.
The full build passes (165.5 s) at
903af4fdb1680204ea31acbb7422f5cf90092b5a; later follow-ups change only one memory test and release-note placement, leaving production byte-identical. The built isolated Gateway passes 12 assertions across five RPCs, exactly matching baseline titles/previews, tool inventories and model catalog. Four fresh real OpenAI sessions return READY and execute sessions_list, web_fetch and native web search; terminal receipts and the native search completion event confirm execution without rerouting. The owned Gateway exits cleanly. Live timings are observational, not speedup evidence.Hosted CI exposed an existing cross-process memory-test observation race: after publication releases its lease, a later reader may already have completed before the test checks an intermediate snapshot. The observed event order was correctly published then next-reader. Remove only that invalid intermediate assertion and explain the release ordering; initial contention, pre-release empty events, final exact ordering and cleanup remain. The seven-test canonical suite passes. An independent actual-process probe reproduces the old failure, passes 24 corrected runs (12 ordinary and 12 late observations), and detects a deliberately broken writer-intent implementation through the retained contention check. This is +1/−1 test lines, with no production, timer or lock change.
The final memory-only changed-file gate also passes. An earlier local attempt failed the topology guard while a native review checkout was changing; rerunning with checkout operations idle passed without relaxing the guard. A separate real-native fixture reproduces this failure mechanism, but the original invocation's complete before/after topology was not retained. The separate build-cache namespace issue is retained as a follow-up; no speculative exclusion is included here.
The reviewed fallback is accepted on this evidence: retain valid static rows, recover discarded selected/credentialed owners through existing canonical registration, and preserve the entries-only boundary. The exact-head real-loader matrix, synthetic-auth and prepared-worker suites, and real Gateway receipts cover the requested activation, ordering and authentication boundaries.
Changelog
Provider discovery prepares manifest catalogs once and recovers discarded discovery entries through the existing scoped loader, so a static catalog cannot hide another selected or credentialed provider after an entry fails.
The native landing workflow reserves root CHANGELOG.md edits for release automation; this ordinary PR carries the release note here. The initial prepare attempt correctly refused the root entry, which was removed without any production or test change. No release-only override is used.