Repository navigation
fix(onboarding): setup detection rescans every plugin package on each call - #169562
Conversation
… call Setup detection loads its local-discovery provider plugins inside a fresh plugin operation so their registrations retire after the probes settle. That empty cache also made the provider lookup rebuild the full plugin metadata snapshot on every call, which dominated the provider-load phase of openclaw.setup.detect. Plugin modules themselves evaluate once per process. Pass the metadata snapshot that already selected the choices into the loader's existing pluginMetadataSnapshot input. The operation cache keeps owning registrations and instances, so the retirement contract is unchanged. Setup activation keeps fresh metadata because it can install the plugin it loads.
|
🦞👀 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. What this changesThis PR reuses prepared plugin metadata when loading setup discovery providers instead of rediscovering installed packages. Example: A user refreshes Connect your AI on the tested Mac Studio.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR: it removes a measured onboarding bottleneck still present on current main while preserving provider selection and plugin cleanup; no actionable correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherNative onboarding, Control UI model setup, and CLI onboarding use shared detection, which selects providers from configuration and plugin metadata, probes local services, and returns available AI choices. flowchart TD
A[Setup clients] --> B[Shared setup detection]
B --> C[Prepared plugin inventory]
C --> D[Provider choice selection]
C --> E[Operation scoped provider loader]
D --> E
E --> F[Local provider probes]
F --> G[Detected AI choices]
F --> H[Plugin cleanup]
Technical reviewBest possible solution: Reuse the choice-selection inventory through the existing loader while preserving operation-owned cleanup and fresh metadata for activation. Do we have a high-confidence way to reproduce the issue? Current main resolves provider metadata inside a fresh probe cache without the prepared snapshot, matching the supplied Gateway measurements; this read-only review ran no target code. Is this the best way to solve the issue? Passing the existing inventory directly targets the measured rebuild, avoids another cache, and preserves live health probes and activation behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2526dd83be90. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +30, Tests +41, Docs +6. Total +77 across 5 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 12, 2026, 12:06 AM ET / 04:06 UTC (Revision 3). |
|
ClawSweeper's completed review of The lead's pre-land review is complete. Exact-head CI passed in run https://github.com/openclaw/openclaw/actions/runs/38201633130 (attempt 1), including |
|
Merged via squash.
|
… call (openclaw#169562) * fix(onboarding): setup detection rescans every plugin package on each call Setup detection loads its local-discovery provider plugins inside a fresh plugin operation so their registrations retire after the probes settle. That empty cache also made the provider lookup rebuild the full plugin metadata snapshot on every call, which dominated the provider-load phase of openclaw.setup.detect. Plugin modules themselves evaluate once per process. Pass the metadata snapshot that already selected the choices into the loader's existing pluginMetadataSnapshot input. The operation cache keeps owning registrations and instances, so the retirement contract is unchanged. Setup activation keeps fresh metadata because it can install the plugin it loads. * test(plugins): explain setup availability inventory mock isolation
…ventory Config reload holds the plugin lifecycle lease, which runs in a fresh operation cache so management sees other processes' commits. Post-commit Gateway readers inherited that cache, could not see the published inventory, and reloaded plugin metadata from disk on the main thread for model-id normalization. As in #169562, the Gateway lifecycle owner now passes the snapshot it published: the chat metadata lifecycle hands it to the model-policy comparison, and the prepared runtime refresh forwards its existing pluginMetadataSnapshot input to configured owner inputs. Lease isolation is unchanged.
…ttings changes (#173626) Related: #173585, #169562 ## What Problem This Solves Fixes: the Gateway main thread blocks for hundreds of milliseconds after a sign-in, sign-out, key removal or plugin settings change, because runtime readers reload plugin metadata from disk although no plugin was installed. ## User Impact User impact: less main-thread blocking after account and plugin settings changes, so model pickers and other Gateway requests stall less. No config, state or plugin contract changes. ## Why This Change Was Made Config hot reload holds the plugin lifecycle lease (since #145484). The lease runs in a fresh operation plugin cache, so management sees what other processes committed while it waited. That isolation stays. But two kinds of work inside it reloaded plugin metadata on every event: 1. **A policy change rescanned the whole inventory.** Plugin activation (`enabled`) is the only config-owned fact in the installed plugin index. A changed policy hash (for example auto-enable after a sign-in) made the registry reader treat the persisted index as stale and run full discovery. Activation is now one projection over inventory records (`projectInstalledPluginIndexPolicy`), used by fresh builds and by the registry reader. When the persisted inventory passes its existing freshness checks and only the policy differs, the reader projects the new policy in memory. Install, uninstall, stale files, load paths and the other existing reasons still rediscover. Freshness checks tolerate missing files only for disabled records, so records the new policy enables are rechecked; if any is stale, the reader rediscovers. This matches the documented rule that enablement is evaluated from the current operation's policy, not stored with the facts. 2. **Post-commit Gateway readers could not see the published inventory.** The model-policy comparison (chat metadata lifecycle) and the prepared model runtime refresh inherit the lease's operation cache, so model-id normalization in `resolveDefaultModelForAgent` loaded a metadata snapshot from disk. As in #169562, the Gateway lifecycle owner now passes the snapshot it published. The chat metadata lifecycle hands `getPluginMetadataSnapshot()` to `modelSelectionPoliciesMatch`. The prepared runtime refresh forwards its existing `pluginMetadataSnapshot` option to the configured owner inputs. Readers without an explicit snapshot keep their current behavior. ## Evidence - Regression tests, each fails on `main` and passes here: - `plugin-registry.test.ts`, "projects a config policy change over the persisted inventory without rescanning": on `main` the extensions dir is rescanned. - `plugin-registry.test.ts`, "rediscovers when a policy enables a persisted plugin whose files are gone": a projection-only reader would return an enabled plugin with no files. - `operator-model-presentation.test.ts`, two tests run inside an operation cache like the reload lease: the policy comparison and prepared runtime input collection load no plugin metadata. On `main` they load 2 and 1 snapshots. - Focused suites pass: plugin registry, index and cache; capability generation; model selection; operator model policy; chat metadata lifecycle; prepared model runtime; agent database startup. Two kinds of local failure, neither CI-relevant: - 4 tests in `plugin-registry` and `installed-plugin-index` fail on macOS on both `main` and this branch (temp-dir environment). - One agent-database-startup test timed out at host load ~60 and passes alone. - Isolated Gateway on a packaged layout (built dist, no `.git`, `src` or `extensions`), compared with the `main` it merges. CPU profile over 20 events (4 each of sign-in, sign-out, key removal, plugin reload and plugin settings change), two interleaved rounds: | Main-thread CPU | main (round 1 / 2) | this PR (round 1 / 2) | |---|---|---| | model-id normalization metadata loads | 22555 / 20521 ms | 2 / 0 ms | | plugin inventory rediscovery | 16873 / 16489 ms | 3638 / 1518 ms | | all plugin metadata snapshot loads | 31650 / 29862 ms | 10194 / 8281 ms | | busy segments ≥ 150 ms | 57 / 67 | 31 / 14 | What remains is `resolveConfigWidePluginMetadataSnapshot`: the explicit plugin reload, which is the owner's refresh path, plus startup config preflight. - `last-heartbeat` lag probe during the event, n = 12 events each, runs interleaved base/PR. Host load was 30–101, so absolute values are inflated: | Event (during) | main p50 / p99 | this PR p50 / p99 | |---|---|---| | sign-in | 1.8 / 698 ms | 2.6 / 329 ms | | sign-out | 3.2 / 790 ms | 4.2 / 489 ms | | key removal | 4.1 / 1009 ms | 2.0 / 359 ms | | plugin reload | 1.4 / 710 ms | 1.0 / 489 ms | | plugin settings change | 0.8 / 157 ms | 0.8 / 138 ms | No run showed a removed provider after its removal (0 violations). Not covered: plugin reload still blocks, from the reload's own metadata refresh, plugin module re-import and runtime publication. That needs a separate change. ## Notes A source checkout (`pnpm-workspace.yaml`, `src` and `extensions` at the package root) cannot measure this. There, `isBundledPluginInsideDevSourceRoot` and the private QA plugins make `requiresDerivedRegistryValidation` reject the persisted index on every read, so local dev Gateways still rescan. Packaged installs do not. ## Merge danger Two-way door: a revert restores the reloads. Nothing is persisted or migrated, and lease isolation is unchanged. Blast radius if wrong: - Plugin activation as seen by Gateway runtime reads after a config change. The projection uses the same rule and inputs as a fresh index build. - Model-id normalization in the post-commit policy comparison and prepared runtime refresh. These use the inventory the Gateway published, which is what other runtime readers already use. Co-authored-by: Ayaan Zaidi <[email protected]>
… config changes (#174860) Related: #173626, #169562 ## What Problem This Solves Fixes: after a config change, sign-in, sign-out or key removal, Gateway work that runs after the change is applied reloads plugin metadata from disk instead of using the inventory the Gateway just published. ## User Impact User impact: config reloads no longer rescan plugin files for cron reconciliation, model-runtime refresh, skills discovery or channels started by the reload. This keeps the Gateway event loop free for `models.list` and other requests during these events. No behavior change for plugin install, update or doctor flows. ## Why This Change Was Made Config hot reload runs inside `withPluginLifecycleLease`. The lease carries a fresh operation `PluginCache` through AsyncLocalStorage, so management reads see commits from other processes. Everything after the runtime commit inherited that cache too. `getGatewayPluginMetadataSnapshot()` only answers for the process cache, so post-commit readers (`resolveProviderIdForAuth` from cron job loading, model-id normalization, skills discovery capture, channel owners started by the reload) found no snapshot and reloaded metadata from disk. Long-lived owners started there also held a cache that the lease retires on release. #173626 fixed the two hottest readers by passing the published snapshot explicitly (the #169562 pattern). This change fixes the owner: `runAfterPluginLifecycleCommit` (in `plugin-lifecycle-lease.ts`) leaves the lease's cache scope at each transaction owner's commit edge, after the new metadata is published: - `config-reload.ts`: `onRuntimeConfigCommitted`, `onConfigApplied`, and `notifyCommitted` (config.changed broadcast, skills discovery refresh). - `server-reload-hot.ts`: the cron drain, reconcile and start after commit, and the rest of the hot reload after commit (prepared model runtime refresh, MCP disposal, Gmail watcher, channel restarts, context windows). - `server-reload-managed-secrets.ts`: committed runtime policy reconcile. - `server-plugin-reload.ts`: the post-publication tail (memory and sidecar resume, lifecycle hooks, `startPublishedChannels`). Work before the commit keeps the operation cache: config validation, install records, secrets preparation and plugin preflight still see other processes' commits. No management read runs after the commit. The cache-boundary docs gain one sentence. ## Evidence - New regression test `server-reload-hot.published-plugin-metadata.test.ts`: real lifecycle lease, a published Gateway snapshot with a provider auth alias, and cron `reconcileSystemJobs` calling `resolveProviderIdForAuth` after the commit. It asserts the commit still runs in the operation cache, the alias resolves from the published snapshot, and `loadPluginMetadataSnapshot` is not called. Without the fix it fails: the reader loads empty metadata from disk and returns `fixture-alias`. - Focused local suites (config reload, lease retry, reload handlers, operator model policy, plugin reload, lifecycle lease): 400 pass. 7 cases in `server-plugin-reload.recovery.test.ts` fail locally; the identical set fails on the base head without this change. - Packaged-layout Gateway bench (sign-in, sign-out, key removal, plugin reload, settings change), with load tracing: the 19 post-commit skills-root rescans on the base drop to 0. The remaining loads are config-write validation before the commit (management, unchanged). - Main-thread CPU profiles, 4 interleaved runs: fix runs show no post-commit metadata loads. One base run spent 0.57 s there (model-id normalization and cron `describeCronInferenceMigration` → `resolveProviderIdForAuth`). Lag numbers were too noisy on the loaded host to report. Simplification: one helper owned by the lease module and applied at four commit edges; no new state. #173626's explicit snapshot inputs stay; they are harmless explicit parameters and can be removed separately. Production delta: +50/-8 lines ignoring re-indentation; one test file. Co-authored-by: Ayaan Zaidi <[email protected]>
…ttings changes (openclaw#173626) Related: openclaw#173585, openclaw#169562 ## What Problem This Solves Fixes: the Gateway main thread blocks for hundreds of milliseconds after a sign-in, sign-out, key removal or plugin settings change, because runtime readers reload plugin metadata from disk although no plugin was installed. ## User Impact User impact: less main-thread blocking after account and plugin settings changes, so model pickers and other Gateway requests stall less. No config, state or plugin contract changes. ## Why This Change Was Made Config hot reload holds the plugin lifecycle lease (since openclaw#145484). The lease runs in a fresh operation plugin cache, so management sees what other processes committed while it waited. That isolation stays. But two kinds of work inside it reloaded plugin metadata on every event: 1. **A policy change rescanned the whole inventory.** Plugin activation (`enabled`) is the only config-owned fact in the installed plugin index. A changed policy hash (for example auto-enable after a sign-in) made the registry reader treat the persisted index as stale and run full discovery. Activation is now one projection over inventory records (`projectInstalledPluginIndexPolicy`), used by fresh builds and by the registry reader. When the persisted inventory passes its existing freshness checks and only the policy differs, the reader projects the new policy in memory. Install, uninstall, stale files, load paths and the other existing reasons still rediscover. Freshness checks tolerate missing files only for disabled records, so records the new policy enables are rechecked; if any is stale, the reader rediscovers. This matches the documented rule that enablement is evaluated from the current operation's policy, not stored with the facts. 2. **Post-commit Gateway readers could not see the published inventory.** The model-policy comparison (chat metadata lifecycle) and the prepared model runtime refresh inherit the lease's operation cache, so model-id normalization in `resolveDefaultModelForAgent` loaded a metadata snapshot from disk. As in openclaw#169562, the Gateway lifecycle owner now passes the snapshot it published. The chat metadata lifecycle hands `getPluginMetadataSnapshot()` to `modelSelectionPoliciesMatch`. The prepared runtime refresh forwards its existing `pluginMetadataSnapshot` option to the configured owner inputs. Readers without an explicit snapshot keep their current behavior. ## Evidence - Regression tests, each fails on `main` and passes here: - `plugin-registry.test.ts`, "projects a config policy change over the persisted inventory without rescanning": on `main` the extensions dir is rescanned. - `plugin-registry.test.ts`, "rediscovers when a policy enables a persisted plugin whose files are gone": a projection-only reader would return an enabled plugin with no files. - `operator-model-presentation.test.ts`, two tests run inside an operation cache like the reload lease: the policy comparison and prepared runtime input collection load no plugin metadata. On `main` they load 2 and 1 snapshots. - Focused suites pass: plugin registry, index and cache; capability generation; model selection; operator model policy; chat metadata lifecycle; prepared model runtime; agent database startup. Two kinds of local failure, neither CI-relevant: - 4 tests in `plugin-registry` and `installed-plugin-index` fail on macOS on both `main` and this branch (temp-dir environment). - One agent-database-startup test timed out at host load ~60 and passes alone. - Isolated Gateway on a packaged layout (built dist, no `.git`, `src` or `extensions`), compared with the `main` it merges. CPU profile over 20 events (4 each of sign-in, sign-out, key removal, plugin reload and plugin settings change), two interleaved rounds: | Main-thread CPU | main (round 1 / 2) | this PR (round 1 / 2) | |---|---|---| | model-id normalization metadata loads | 22555 / 20521 ms | 2 / 0 ms | | plugin inventory rediscovery | 16873 / 16489 ms | 3638 / 1518 ms | | all plugin metadata snapshot loads | 31650 / 29862 ms | 10194 / 8281 ms | | busy segments ≥ 150 ms | 57 / 67 | 31 / 14 | What remains is `resolveConfigWidePluginMetadataSnapshot`: the explicit plugin reload, which is the owner's refresh path, plus startup config preflight. - `last-heartbeat` lag probe during the event, n = 12 events each, runs interleaved base/PR. Host load was 30–101, so absolute values are inflated: | Event (during) | main p50 / p99 | this PR p50 / p99 | |---|---|---| | sign-in | 1.8 / 698 ms | 2.6 / 329 ms | | sign-out | 3.2 / 790 ms | 4.2 / 489 ms | | key removal | 4.1 / 1009 ms | 2.0 / 359 ms | | plugin reload | 1.4 / 710 ms | 1.0 / 489 ms | | plugin settings change | 0.8 / 157 ms | 0.8 / 138 ms | No run showed a removed provider after its removal (0 violations). Not covered: plugin reload still blocks, from the reload's own metadata refresh, plugin module re-import and runtime publication. That needs a separate change. ## Notes A source checkout (`pnpm-workspace.yaml`, `src` and `extensions` at the package root) cannot measure this. There, `isBundledPluginInsideDevSourceRoot` and the private QA plugins make `requiresDerivedRegistryValidation` reject the persisted index on every read, so local dev Gateways still rescan. Packaged installs do not. ## Merge danger Two-way door: a revert restores the reloads. Nothing is persisted or migrated, and lease isolation is unchanged. Blast radius if wrong: - Plugin activation as seen by Gateway runtime reads after a config change. The projection uses the same rule and inputs as a fresh index build. - Model-id normalization in the post-commit policy comparison and prepared runtime refresh. These use the inventory the Gateway published, which is what other runtime readers already use. Co-authored-by: Ayaan Zaidi <[email protected]>
… config changes (openclaw#174860) Related: openclaw#173626, openclaw#169562 ## What Problem This Solves Fixes: after a config change, sign-in, sign-out or key removal, Gateway work that runs after the change is applied reloads plugin metadata from disk instead of using the inventory the Gateway just published. ## User Impact User impact: config reloads no longer rescan plugin files for cron reconciliation, model-runtime refresh, skills discovery or channels started by the reload. This keeps the Gateway event loop free for `models.list` and other requests during these events. No behavior change for plugin install, update or doctor flows. ## Why This Change Was Made Config hot reload runs inside `withPluginLifecycleLease`. The lease carries a fresh operation `PluginCache` through AsyncLocalStorage, so management reads see commits from other processes. Everything after the runtime commit inherited that cache too. `getGatewayPluginMetadataSnapshot()` only answers for the process cache, so post-commit readers (`resolveProviderIdForAuth` from cron job loading, model-id normalization, skills discovery capture, channel owners started by the reload) found no snapshot and reloaded metadata from disk. Long-lived owners started there also held a cache that the lease retires on release. openclaw#173626 fixed the two hottest readers by passing the published snapshot explicitly (the openclaw#169562 pattern). This change fixes the owner: `runAfterPluginLifecycleCommit` (in `plugin-lifecycle-lease.ts`) leaves the lease's cache scope at each transaction owner's commit edge, after the new metadata is published: - `config-reload.ts`: `onRuntimeConfigCommitted`, `onConfigApplied`, and `notifyCommitted` (config.changed broadcast, skills discovery refresh). - `server-reload-hot.ts`: the cron drain, reconcile and start after commit, and the rest of the hot reload after commit (prepared model runtime refresh, MCP disposal, Gmail watcher, channel restarts, context windows). - `server-reload-managed-secrets.ts`: committed runtime policy reconcile. - `server-plugin-reload.ts`: the post-publication tail (memory and sidecar resume, lifecycle hooks, `startPublishedChannels`). Work before the commit keeps the operation cache: config validation, install records, secrets preparation and plugin preflight still see other processes' commits. No management read runs after the commit. The cache-boundary docs gain one sentence. ## Evidence - New regression test `server-reload-hot.published-plugin-metadata.test.ts`: real lifecycle lease, a published Gateway snapshot with a provider auth alias, and cron `reconcileSystemJobs` calling `resolveProviderIdForAuth` after the commit. It asserts the commit still runs in the operation cache, the alias resolves from the published snapshot, and `loadPluginMetadataSnapshot` is not called. Without the fix it fails: the reader loads empty metadata from disk and returns `fixture-alias`. - Focused local suites (config reload, lease retry, reload handlers, operator model policy, plugin reload, lifecycle lease): 400 pass. 7 cases in `server-plugin-reload.recovery.test.ts` fail locally; the identical set fails on the base head without this change. - Packaged-layout Gateway bench (sign-in, sign-out, key removal, plugin reload, settings change), with load tracing: the 19 post-commit skills-root rescans on the base drop to 0. The remaining loads are config-write validation before the commit (management, unchanged). - Main-thread CPU profiles, 4 interleaved runs: fix runs show no post-commit metadata loads. One base run spent 0.57 s there (model-id normalization and cron `describeCronInferenceMigration` → `resolveProviderIdForAuth`). Lag numbers were too noisy on the loaded host to report. Simplification: one helper owned by the lease module and applied at four commit edges; no new state. openclaw#173626's explicit snapshot inputs stay; they are harmless explicit parameters and can be removed separately. Production delta: +50/-8 lines ignoring re-indentation; one test file. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #169472
What Problem This Solves
Fixes: every setup detection (the macOS "Connect your AI" page, Control UI model setup,
openclaw onboard) spends most of a second rediscovering every installed plugin package before it can probe local providers, even though nothing changed since the previous detection.User Impact
User impact: setup detection lists its options sooner, most noticeably when it runs again (after sign-in or on refresh). The provider step before the local probes is about 2.5× faster on the first detection and nearly 4× faster on repeat detections. The detected options are unchanged.
Why This Change Was Made
Setup detection loads the provider plugins that own local discovery (Apple Foundation Models, LM Studio, Ollama, llama.cpp) inside a short-lived plugin operation so their registrations retire once the probes settle. That operation starts with an empty plugin cache, so its provider lookup rebuilt the complete plugin metadata snapshot (every manifest and package) on each call. Profiling showed this rebuild was the dominant cost; the plugin modules themselves are evaluated only once per process.
Detection already holds the metadata snapshot that selected its provider choices (the Gateway's boot inventory when Gateway-hosted). It now passes that snapshot to the provider load through the loader's existing prepared-snapshot input. The operation cache still owns the registrations and plugin instances, so the existing retirement contract is unchanged. The classic setup picker prepares one snapshot for both its choice list and provider load.
Setup activation is intentionally left alone: it can install the plugin it is about to load, so it keeps preparing fresh metadata.
Evidence
Real entry point, run the way the app runs it: the bundled Bun fork from OpenClaw.app, started with
openclaw.mjs gateway run --port <random>. Each run used a freshOPENCLAW_STATE_DIRand scratchHOMEunder$(getconf DARWIN_USER_TEMP_DIR), token auth and the stdin lifeline.openclaw.setup.detectwas called three times per Gateway right after/readyz. Both arms aremainat 521393e with the same temporary, env-gated phase marks (not committed); only this change differs. Five pairs, alternating order. Host: 32-core Mac Studio under heavy shared load (load average 42–81).Where the time went (temporary instrumentation): plugin modules, including the lazily imported Apple Foundation Models helper, evaluate once per process; later detections never re-evaluate them (checked with eval counters in the built plugin entries). Registration is under 1 ms per plugin and cache retirement is about 0 ms. The provider lookup's metadata rebuild was the dominant per-call cost.
Alternating A/B, medians in ms. Provider load is everything from lease acquisition until the probes start: lease, capability consent, provider lookup, plugin registration.
mainThese arms predate fix(onboarding): Connect your AI page is slow to list options on first run #169472, so their end-to-end server times (14.4 → 12.0 s first, 7.6 → 6.4 s repeat) are dominated by the Apple Foundation Models compile it fixed, plus host load; the provider-load phase is the meaningful comparison there.
End-to-end on top of fix(onboarding): Connect your AI page is slow to list options on first run #169472, without instrumentation: this head vs its exact base
e4822908bf, five alternating pairs, load average 29–47. The median first detection dropped from 14.2 s to 8.4 s, and this head was faster in all five pairs. Repeat detections dropped from 5.5 s to 4.9 s. These include host load and probe variance; the provider-load table above is the attributable saving. Results matched within each pair except pair 3, where the local Ollama server had unloaded its model before the second arm ran. This head detected Ollama in the other four pairs.Identical results (instrumented A/B): within every pair both arms returned the same detection, apart from host-caused variance that hit both arms. A local Ollama model loaded mid-run showed up in both arms of pair 5. One
maincall hit the 30 s deadline at load average 81 and returned partial results. One variant result appeared once in each arm.Tests (no real timers):
pnpm test src/plugins/provider-setup-availability.test.ts src/system-agent/setup-inference-detect.lifecycle.test.ts src/system-agent/setup-inference-detect.test.ts --maxWorkers=1: 17 passed. The new unit test takes 34 ms; the lifecycle assertions add no measurable time to the existing real-fixture cases.expected undefined to be { … }: provider loading never received the inventory) and the new unit test fails. The existing retirement assertions (register per call, dispose after the probes settle, no lease held during a pending probe) keep passing with the change.oxlintandoxfmton the changed files, and theplugins-platformandservicestest-project typechecks are clean.node scripts/check-changed.mjspassed every lane, including the core and core-test typechecks, plugin boundaries and the ratchets, except the local dead-export scan. That scan flagged 146 exports in files this PR does not touch, including exports that have production consumers, so it is an artifact of the nested worktree. This branch adds or removes no exports; hosted CI runs the authoritative scan.mainwith fix(onboarding): Connect your AI page is slow to list options on first run #169472 merged, the focused tests (20, including fix(onboarding): Connect your AI page is slow to list options on first run #169472's new ones), the core typecheck and theservicestest-project typecheck pass on this head.Codex autoreview (
gpt-6.1-sol, high, P0–P1) reported no actionable findings.Remaining fixed cost, left as follow-ups: capability consent's first
enablePluginInConfigcall rescans the bundled channel catalog in each fresh operation cache (about 0.1–0.3 s under this load), and saved sign-ins without setup metadata still load their provider with fresh metadata per profile.Release-note context: setup detection (macOS onboarding, Control UI model setup, CLI onboarding) lists AI options sooner, especially on repeated detection; the options offered are unchanged.