Skip to content

perf(onboarding): avoid broad provider-auth runtime imports - #127680

Merged
steipete merged 1 commit into
mainfrom
perf/onboarding-provider-auth-imports-681827
Aug 21, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/onboarding-provider-auth-imports-681827

Conversation

@steipete

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Onboarding provider authentication loaded the complete agent model-selection and provider-credential runtime merely to lowercase provider selectors. The focused eight-case onboarding suite imported 1,344 modules for roughly 15 ms of actual test execution; the same accidental dependency edges also inflated production auth-choice loading.

Why This Change Was Made

Use the existing canonical model-catalog provider-ID normalizer and existing canonical string normalizer directly at their actual consumers. Both previous wrappers delegate to those exact implementations, so provider aliases, selected-agent workspace ownership, manifest/catalog routing, public onboarding flags, profile persistence, and plugin boundaries remain unchanged. No mocks, test seams, dependencies, configuration, or production lines were added.

User Impact

Onboarding provider-auth choice preparation avoids loading unrelated model-selection, runtime registry, plugin loader, session, and credential graphs. Provider selection and observable CLI/configuration behavior are unchanged.

Evidence

Eight interleaved, order-balanced baseline/candidate pairs on the same Blacksmith Testbox, after excluded warmups; one Vitest worker, distinct filesystem module-cache paths, complete import-duration reporting, and /usr/bin/time -v:

Pair Baseline wall Candidate wall Improvement
1 7.23s 4.31s 2.92s
2 7.10s 4.47s 2.63s
3 6.94s 4.37s 2.57s
4 7.14s 4.47s 2.67s
5 7.30s 4.32s 2.98s
6 7.13s 4.46s 2.67s
7 7.21s 4.42s 2.79s
8 7.01s 4.38s 2.63s
Mean 7.13s 4.40s 2.73s / 38.3%
  • Import phase: 3.36s → 0.70s (79.1% faster); loaded modules: 1,344 → 404 (940 fewer).
  • Peak RSS: 587,733 → 511,887 KiB (12.9% lower).
  • All eight original onboarding cases remain unchanged. Reversible fault injection removing selected-workspace forwarding failed the three corresponding API-key/token cases; weakening untrusted-workspace filtering failed the install-catalog case.
  • Focused owner/sibling/package/provider proof: 142 tests across seven Vitest shards, including interactive and non-interactive onboarding, provider-auth configuration, manifest trust policy, normalization contracts, OpenAI, and GitHub Copilot.
  • Changed Vitest routing: 29 tests across two owner shards.
  • Complete pnpm check:changed, pnpm build, targeted formatting, git diff --check, and fresh structured autoreview.
  • Production LOC: +3/-3 (net zero). Tests: unchanged.
  • Benchmark Testbox: tbx_01m0k7mptwgqvanadkxwcvhh01.

AI-assisted; no agent transcript.

@clawsweeper

clawsweeper Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: XS maintainer Maintainer-authored PR labels Aug 21, 2026
@steipete
steipete marked this pull request as ready for review August 21, 2026 23:16
@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer proof for head 8f429c3f1820c2ea12c3b708be4165c6f820ccb7:

  • Same Blacksmith Testbox, excluded warmups, eight interleaved/order-balanced retained pairs, one Vitest worker, unique filesystem module-cache paths, full import-duration diagnostics, and /usr/bin/time -v: 7.13s -> 4.40s mean scoped wall (-2.73s / -38.3%); import phase 3.36s -> 0.70s (-79.1%); 1,344 -> 404 loaded modules; mean peak RSS 587,733 -> 511,887 KiB (-12.9%).
  • Architectural owner proof: normalizeProviderId already belongs to @openclaw/model-catalog-core/provider-id; the prior agent model-selection import only re-exported it. normalizeTokenProviderInput delegates directly to the existing normalizeOptionalLowercaseString canonical string normalizer. Both replacements preserve the real provider/plugin manifest, auth-choice routing, workspace ownership, and trust-policy composition.
  • Reversible coverage proof: dropping selected-agent workspace forwarding fails the three existing API-key/token onboarding cases; accepting untrusted workspace plugins fails the existing install-catalog case. No tests, mocks, snapshots, contracts, configuration, dependencies, or production LOC were added.
  • Hosted owner/boundary proof: 142 tests across seven Vitest shards, 29 changed-route tests, complete pnpm check:changed, full pnpm build including 61 plugin distributions and every public SDK export. Post-rebase proportional rerun: 65 tests across three shards. Fresh structured review: zero actionable findings.
  • Exact-head GitHub Actions: https://github.com/openclaw/openclaw/actions/runs/32536266731
  • Production delta: +3/-3; test delta: +0/-0. No ClawSweeper rank-up requests were present at review time.

@steipete
steipete merged commit 79c8251 into main Aug 21, 2026
296 checks passed
@steipete
steipete deleted the perf/onboarding-provider-auth-imports-681827 branch August 21, 2026 23:26
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant