You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c6d6706
Browse filesBrowse the repository at this point in the historyBrowse files
perf(agents): reuse gateway plugin generation for prepared model runtime (#126630)
* perf(agents): reuse gateway plugin generation for prepared model runtime
The model-runtime sidecar rebuilt two broad plugin registries on gateway
startup: 167 imports across 84 plugins (83 loaded twice) with 82 forced
TypeScript transformations, ~39.6s of a ~50s source-checkout startup.
- Reuse the active gateway registry for inbound dispatch when the
gateway-bindable subagent mode, workspace, and manifest identity of the
requesting snapshot generation all match; fall back to isolated loading
otherwise.
- Seed the runtime registry from the inbound registry's plugin ids instead
of a second unscoped broad load.
- Prefer built plugin artifacts on the agents lane, matching the gateway
loader; externally-packaged plugins no longer force source transforms.
Measured (M3 Ultra, dist build, median of 3): sidecars.model-runtime
33.93s -> 0.379s; gateway readiness 41.69s -> 7.58s; plugin imports
167 -> 18; TypeScript transformations 82 -> 0.
* fix(agents): keep source artifacts on isolated agent registry loads
The full agents lane caught ~20 Code Mode regressions from preferring
built artifacts on the agents loader lane: in a source checkout a stale
dist silently replaces edited plugin source. The gateway-generation
reuse already removes the broad re-imports that made source transforms
expensive, so the artifact preference is unnecessary for the startup
win and unsafe for dev checkouts.
* fix(agents): bind gateway registry reuse to the current metadata generation
Reuse authority is identity-based: the requesting snapshot must be the
process-current published generation. Bundled manifest records compare by
id+origin only, so an equivalence check alone could let an older or leaked
active registry serve a different generation's plugins.
* perf(agents): resolve prepared-runtime metadata through the current generation
The sidecar acquired its snapshot with loadPluginMetadataSnapshot, which
always constructs a fresh object, so the generation-identity reuse guard
could never hold in the gateway and inbound loads stayed isolated. Resolve
through the slot-probing entry instead; the published current generation
satisfies the read and registry reuse engages.
Test updates: model the current-generation identity in the reuse fixture,
drop stale preferBuiltPluginArtifacts expectations from the isolated-load
fixtures, and add a negative case proving a non-current generation refuses
reuse.
* perf(agents): inherit gateway artifact preference when extending its generation
The runtime-registry delta load re-imported teams-meetings and zoom-meetings
channel graphs through forced source transforms (~9.2s) even though the
reused gateway generation had already realized them from built artifacts.
When the inbound registry is the active gateway registry, the delta load now
inherits the generation owner's built-artifact preference; isolated loads
keep source truth, so source-executed tests and dev flows are unaffected.
Measured (M3 Ultra, dist build, 3 runs): sidecars.model-runtime
289-331ms (baseline 33,930ms); gateway ready 3.7-4.0s (baseline 41.7s);
forced source transforms 0 (baseline 82).
* test(agents): count both slot-probing metadata resolutions in static startup
The prepared cold plugin context now resolves through the canonical
slot-probing entry, joining the model-id normalization lane's existing
resolution. Both share the published generation; the eager-work
protections remain the catalog laziness assertions.
* refactor(agents): compose generation reuse with lifecycle artifact selection
Rebase over #125957, which preserves built-artifact mode for
lifecycle-selected prepared registries. Reuse of the active gateway
generation and the generation-inherited delta preference compose with
that owner's parameter instead of duplicating the forwarding.
0 commit comments