Repository navigation
perf(agents): reuse active Gateway plugin generation - #127278
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 2:29 PM ET / 18:29 UTC. ClawSweeper reviewWhat this changesThis PR restricts prepared model runtimes to reusing only the exact active Gateway plugin generation, while loading selected runtime plugins as a delta that leaves deferred plugins eligible for scoped loading. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessKeep open. Current main still contains the merged reuse implementation this PR corrects; the exact-head patch adds the missing strict workspace-generation guard and retains lifecycle-owned artifact selection. No blocking patch defect was found. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherGateway publishes a process-wide plugin registry and metadata generation during startup. Prepared model runtimes consume those facts to load provider and tool plugins, either safely reusing the active generation or independently loading an isolated registry. flowchart LR
A[Gateway startup] --> B[Published plugin metadata]
A --> C[Active plugin registry]
D[Prepared model runtime] --> E[Generation and workspace checks]
B --> E
C --> E
E -->|Exact match| F[Reuse inbound registry]
E -->|Mismatch| G[Independent registry load]
F --> H[Selected plugin delta]
G --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource -14, Tests +12. Total -2 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the strict generation/workspace reuse guard after exact-head checks confirm both Gateway startup and deferred scoped-plugin loading remain healthy. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main's workspace condition accepts an undefined active workspace, while the exact-head guard rejects it and the focused tests exercise incompatible reuse paths. Is this the best way to solve the issue? Yes. The patch fixes reuse at the lifecycle owner with exact workspace and metadata identity checks, while leaving built-artifact preference with the prepared generation that owns it. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ee79b0a49ae4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Reuse the active Gateway registry only for the exact current metadata generation and matching runtime authority. Seed selected-runtime loading from imported inbound plugin IDs so deferred records remain eligible for their scoped load, while the generation owner continues to supply built-artifact preference. Co-authored-by: Peter Steinberger <[email protected]>
44e91fc to
aa25d4e
Compare
|
Merged via squash.
|
Reuse the active Gateway registry only for the exact current metadata generation and matching runtime authority. Seed selected-runtime loading from imported inbound plugin IDs so deferred records remain eligible for their scoped load, while the generation owner continues to supply built-artifact preference. Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Corrects the active Gateway generation reuse that landed in #126630 while this replacement was under review. The landed version inferred built-artifact preference from active-registry identity and allowed an undefined active workspace to match any prepared workspace. This replacement keeps generation reuse, slot-probing metadata resolution, and delta-only plugin loading while restoring explicit lifecycle ownership.
Supersedes the implementation in #126630 while preserving Peter Steinberger's co-author credit.
Why This Change Was Made
The prepared runtime reuses the active Gateway registry only when the caller has Gateway binding authority, uses the default process environment, matches the active workspace and bindable mode, supplies the exact current metadata object, and matches the active registry records to that metadata generation.
Selected runtime plugins load as a delta seeded from imported inbound plugin IDs, so deferred records remain eligible for their scoped load.
preferBuiltPluginArtifactsremains owned by the prepared generation introduced in #125957; this change removes the duplicateextendsActiveGatewayGenerationinference.User Impact
Gateway startup keeps the reuse optimization while stale, mismatched, isolated, and custom-environment runtimes continue through the existing independent load path. No config or public API changes.
Evidence
aa25d4ebf888bab6172a370c5a51ac6aabcf8fe1git diff --check: passedtbx_01m0jjw54pmrrgwmcspxcakvfr:pnpm build, singleton packaging, and explicit changed gates passedpreparedRuntimeScaleMany:a2f0b84e8adad3c29e11d6510809779963d748ee: readyz median 9247ms; model-runtime median 371.9ms; plugin imports 4; source transforms 0