Skip to content

perf(cli): split plugin registry startup timing - #119318

Merged
vincentkoc merged 2 commits into
mainfrom
perf/cli-plugin-registry-timing-20260804
Aug 4, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
perf/cli-plugin-registry-timing-20260804

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 4, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Latest-main Kova runs can attribute roughly 1.3 seconds to CLI plugin-registry startup, but the existing aggregate cannot distinguish lazy module import from runtime registry loading. That makes the next performance change speculative.

Why This Change Was Made

Add nested cli.command-startup spans for the plugin-registry module import and runtime load while preserving the existing parent aggregate. Plugin activation, config handling, cache behavior, and log routing remain unchanged.

User Impact

There is no direct user-visible behavior change. Maintainers can now identify whether CLI plugin startup time belongs to the import graph or registry work before choosing an optimization.

Evidence

  • Exact-main Kova run kova-260804-185805-67747a passed 5/5 at 832459d2ae76; the existing plugin-registry stage remained the largest unattributed warm-start bucket.
  • node scripts/run-vitest.mjs src/cli/plugin-registry-loader.test.ts src/cli/command-bootstrap.test.ts src/cli/command-startup-timing.test.ts (14 tests passed).
  • Core production and core-test tsgo checks passed.
  • env CI=1 PNPM_CONFIG_VERIFY_DEPS_BEFORE_RUN=false node scripts/build-all.mjs cliStartup passed.
  • Targeted oxfmt, oxlint, and git diff --check passed.
  • The staged test-temp creation guard returned no findings after switching to the shared auto-cleanup tracker.
  • Local autoreview reported no actionable findings and rated the patch correct at 0.99.
  • Production delta: +22/-16 (net +6); tests: +34/-0.

AI-assisted: yes. The implementation, ownership boundary, and proof were verified against current main.

Punchcard-Session: coral-workshop-workshop-3f

Punchcard-Session: coral-workshop-workshop-3f
@vincentkoc vincentkoc self-assigned this Aug 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S maintainer Maintainer-authored PR labels Aug 4, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 4, 2026 19:28
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

Punchcard-Session: coral-workshop-workshop-3f
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 4:03 PM ET / 20:03 UTC.

ClawSweeper review

What this changes

The PR separates CLI plugin-registry startup diagnostics into lazy module-import and registry-runtime-load timing spans while keeping the existing aggregate span.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No blocking correctness or security finding: the PR preserves the existing aggregate startup span and adds its child spans at the loader boundary. Current main does not contain this observability improvement, so this maintainer-authored PR remains useful for normal human review.

Priority: P3
Reviewed head: 43e4cdf51a64515b54babe283c2dc53a21deae8c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-neutral instrumentation patch with source-backed nesting coverage and documented validation.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This maintainer-authored internal diagnostics change is outside the external-contributor proof gate; the PR body supplies focused test, type, build, and Kova evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal diagnostics change is outside the external-contributor proof gate; the PR body supplies focused test, type, build, and Kova evidence.
Evidence reviewed 5 items Preserved timing owner: Current main keeps the existing plugin-registry parent span in command bootstrap; the PR adds only nested spans inside its loader.
Correct loader boundary: The PR wraps the cached dynamic import and the synchronous registry activation separately, retaining the existing stderr-routing try/finally.
Nested-span contract: Diagnostics spans inherit the active parent through AsyncLocalStorage and emit an end or error before rethrowing; existing tests cover nested parentage and failure behavior.
Findings None None.
Security None None.

How this fits together

CLI startup conditionally loads plugin metadata before commands run. The diagnostics timeline records that startup work so maintainers can distinguish import-graph cost from registry activation cost.

flowchart LR
  A[CLI startup] --> B[Plugin registry aggregate]
  B --> C[Lazy module import]
  C --> D[Registry runtime load]
  D --> E[Diagnostics timeline]
  E --> F[Performance analysis]
Loading

Before merge

  • Complete next step (P2) - This maintainer-authored, maintainer-labeled PR has no mechanical repair to dispatch; it needs normal human review of the current discussion before landing.
Agent review details

Security

None.

PR surface

Source +6, Tests +34. Total +40 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 22 16 +6
Tests 1 34 0 +34
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 56 16 +40

Review metrics

Metric Value Why it matters
Production vs test LOC production +22/-16 (net +6); tests +34/-0 The small production increase adds two diagnostics boundaries, while the test delta verifies their nesting in a real timeline file.

Stored data model

Persistent data-model change detected: serialized state: src/cli/plugin-registry-loader.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Land the nested timing breakdown after a human reviewer confirms the latest PR-review discussion has no remaining rank-up move.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds timing observability rather than repairing a reported user failure; its timeline behavior is directly covered by source and focused tests.

Is this the best way to solve the issue?

Yes. The loader is the narrow owner boundary between the lazy module import and synchronous registry activation, while command bootstrap retains the aggregate stage needed for total startup timing.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against aa07d55ec98f.

Labels

Label changes:

  • add P3: This is low-risk internal performance observability with no direct user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal diagnostics change is outside the external-contributor proof gate; the PR body supplies focused test, type, build, and Kova evidence.

Label justifications:

  • P3: This is low-risk internal performance observability with no direct user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal diagnostics change is outside the external-contributor proof gate; the PR body supplies focused test, type, build, and Kova evidence.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Current-main blame assigns the loader and bootstrap timing boundary to this author, and the introducing commit added the timing helper, bootstrap, and loader together. (role: introduced current CLI timing and loader boundary; recent area contributor; confidence: high; commits: 9d6d9af94135, 51ecb41a5a22, 43e4cdf51a64; files: src/cli/plugin-registry-loader.ts, src/cli/command-bootstrap.ts, src/cli/command-startup-timing.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Before landing, read the latest ClawSweeper comment and confirm any listed rank-up moves are resolved or intentionally waived.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer review completed on exact head 43e4cdf51a64515b54babe283c2dc53a21deae8c.

I reviewed the latest ClawSweeper discussion plus the repo-native review and prepare artifacts. There are no blocking correctness or security findings, and no code-changing rank-up move remains. The stored-data note is a test-only diagnostics timeline JSONL assertion in src/cli/plugin-registry-loader.test.ts; this PR does not change a production persistence schema or migration surface.

The ClawSweeper Before merge maintainer-review item and its rank-up confirmation are resolved. No waiver is needed.

@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: perf(cli): split plugin registry startup timing This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@vincentkoc
vincentkoc merged commit 6293b54 into main Aug 4, 2026
133 of 135 checks passed
@vincentkoc
vincentkoc deleted the perf/cli-plugin-registry-timing-20260804 branch August 4, 2026 20:08
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 4, 2026
Punchcard-Session: crisp-lantern-orchard-nv

* origin/main:
  fix(release): accept legacy empty core artifacts (#119337)
  fix(qa): carry selected runtime into flow scenarios (#119324)
  fix(ci): retry interrupted Windows dashboard release checks (#119095)
  fix(release): filter validation ancestry fetch (#119334)
  fix(release): accept trusted extended-stable validation evidence (#119264)
  fix(sessions): preserve recorder-owned user turns (#119307)
  perf(cli): split plugin registry startup timing (#119318)
  fix(qa): align release scenario setup and compaction proof (#119188)
  fix(ci): avoid duplicate Matrix release QA runs (#119171)
vincentkoc added a commit that referenced this pull request Aug 5, 2026
…time

* origin/main: (75 commits)
  fix(commands): restore tool inventory for dynamic models (#119306)
  fix(media): release rejected BytePlus and Runway video downloads under debug capture (#119257)
  docs: add ChromeOS (Crostini) platform install guide (#107663)
  test(msteams): serve JWKS from in-process server in auth coverage (#119354)
  fix(qa): enable OpenAI for stored audio scenario (#119349)
  test(agents): realpath apply-patch temp dir fixture (#119353)
  test(slack): drop redundant .js-suffixed system-event mock (#119352)
  fix(exec): leave safe builtins unrewritten in enforced mode (#119351)
  fix(sessions): keep gateway responsive while large transcript archives are built (#112424)
  fix(tui): restore provider auth in installed local mode (#119283)
  fix(release): accept legacy empty core artifacts (#119337)
  fix(qa): carry selected runtime into flow scenarios (#119324)
  fix(ci): retry interrupted Windows dashboard release checks (#119095)
  fix(release): filter validation ancestry fetch (#119334)
  fix(release): accept trusted extended-stable validation evidence (#119264)
  fix(sessions): preserve recorder-owned user turns (#119307)
  perf(cli): split plugin registry startup timing (#119318)
  fix(qa): align release scenario setup and compaction proof (#119188)
  fix(ci): avoid duplicate Matrix release QA runs (#119171)
  perf(agents): reuse provider policy manifest registry (#119305)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
* perf(cli): split plugin registry startup timing

Punchcard-Session: coral-workshop-workshop-3f

* test(cli): use managed temp directory cleanup

Punchcard-Session: coral-workshop-workshop-3f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant