Skip to content

fix(plugins): reduce bundled catalog lookup overhead - #140597

Merged
steipete merged 1 commit into
mainfrom
codex/perf14-bundled-catalog-loading
Sep 7, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf14-bundled-catalog-loading

Conversation

@steipete

@steipete steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Closes #140595

Additional instructions

Maintainer edits are enabled on this repository-owned branch.

What Problem This Solves

Resolves avoidable work during bundled plugin package and manifest lookups: each direct query rebuilds complete catalog collections, and the static lookup import loads hosted fetching and artifact-download implementations.

Why This Change Was Made

Share one typed raw bundled source, validate and deduplicate live rows as queries iterate, and stop direct lookups at the matching row. Move hosted fetching behind the existing async public entrypoint and move pure ClawHub integrity helpers into a leaf module used by their real consumers. Remove the duplicate raw-target type mirror and its assertion.

Shared rows remain mutable and list APIs return fresh outer arrays. Conservative repair targets still inspect raw shadowed and source-rejected rows with current environment/configuration. Hosted validation, signed-feed monotonicity, snapshot/fallback behavior, freshness and helper/error identity retain their existing contracts.

User Impact

Static catalog users load a smaller module graph and do less repeated lookup work. In the paired built probe, the median 95,000-lookup run improved from 1001.76 ms to 531.07 ms; one sweep of 95 rows saves about 0.47 ms. Cold import loaded 58 module URLs instead of 255.

This is an import and representation repair, not a net source-deletion claim: production is +68 lines, tests are +239, and two obsolete ratchet entries were mechanically removed. Related #138312 and active #135997 address distinct work; preserve the latter's type re-export removal during integration.

Evidence

  • 138 focused tests passed across official catalogs, tiny mutable/source-filter fixtures, conservative targets, signed envelopes and ClawHub artifact/integrity behavior.
  • Complete check:changed and full build passed. Independent isolated P2 autoreview found no actionable findings; all 18 final source hashes and the unchanged lockfile match the reviewed manifest.
  • The same final probe ran on both source and built outputs after normal frozen installs, with both heavy slots reserved to exclude overlapping admitted jobs. Both sides ran five samples of 95,000 real package/manifest lookups over 95 rows, with matching checksum 475,000.
  • Built module URLs fell from 255 to 58. One paired cold-import sample measured 86.16 ms to 11.54 ms and immediate RSS of 72.06 MiB to 50.20 MiB. Download, client, temporary-download and hosted-loader implementations were absent from the repaired static import graph.

The cold import and RSS values are single isolated observations, not full-Gateway gains. Source bytes are not heap bytes. Minor-GC events increased from 1425 to 1954; no reduction in collection count or exact allocated-byte total is claimed.

Share the typed raw bundled inventory, short-circuit direct lookups, and keep hosted fetching and artifact download code behind their runtime owners. Preserve live row mutation, fresh list arrays, source-reference filtering, conservative raw repair targets, hosted trust/freshness and integrity behavior.

Validated 138 focused tests, full check:changed, full build, and independent isolated P2 autoreview. In an isolated built probe, 95,000 lookups took 531.07 ms instead of 1001.76 ms, and cold import loaded 58 modules instead of 255; these are catalog measurements, not full-Gateway claims.
@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 01:49
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. labels Sep 7, 2026
@clawsweeper

clawsweeper Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 9:55 PM ET / September 7, 2026, 01:55 UTC.

ClawSweeper review

What this changes

The PR reduces repeated bundled plugin catalog work, loads hosted catalog services lazily, and separates integrity normalization from artifact downloads while preserving lookup behavior.

Merge readiness

✅ Ready for maintainer review

This remains a useful, bounded performance improvement: current main retains the reported overhead, and the related merged optimization addresses different work. No blocking correctness defect was found.

Priority: P3
Reviewed head: 1ccfd576e77e2467c0de115286b2454551ecaf82

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused optimization with relevant production-path measurements, useful contract coverage, and no identified blocking defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied body records paired runs through actual source and built catalog lookup exports, with matching results, lower lookup time, and fewer loaded modules; this directly exercises the changed owner and appropriately limits the performance claims.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied body records paired runs through actual source and built catalog lookup exports, with matching results, lower lookup time, and fewer loaded modules; this directly exercises the changed owner and appropriately limits the performance claims.
Evidence reviewed 7 items Current main still contains the overhead: The catalog, bundled inventory, repair targets, and artifact owner are unchanged between the pinned merge base and fetched main. Main still builds complete catalog collections for direct lookups and imports artifact-download code.
Latest release retains the original lookup path: The supplied v2026.9.2 release commit imports clawhub-artifacts and uses full catalog listing before package lookup; this optimization is not present there.
Lookup invariants preserved: The iterator filters source references before first-wins deduplication and reads shared rows on each query. Dedicated fixtures cover case-sensitive identities, fresh outer arrays, row mutations, and raw shadowed/source-rejected repair hints.
Findings None None.
Security None None.

How this fits together

OpenClaw’s plugin catalog supplies package and manifest metadata to discovery, installation, and repair. Bundled lookups read generated metadata locally; hosted refreshes separately fetch and validate catalog feeds.

flowchart TD
  A[Bundled catalog metadata] --> B[Shared raw inventory]
  B --> C[Source filtering and first-match lookup]
  C --> D[Plugin discovery and installation]
  B --> E[Conservative repair checks]
  F[Hosted refresh request] --> G[Lazy feed validation and snapshots]
  G --> D
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +68, Tests +239, Other -2. Total +305 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 13 1271 1203 +68
Tests 3 243 4 +239
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 0 2 -2
Total 18 1514 1209 +305

Review metrics

Metric Value Why it matters
Reported lookup improvement 95,000 lookups: 1001.76 ms → 531.07 ms median The paired production-path probe supports a catalog-local benefit without claiming whole-Gateway gains.
Net source growth Production +68 lines; tests +239 lines Production growth supports separating lazy hosted loading from static queries; most displayed churn is code movement.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #140595
Summary: This PR is the implementation candidate for the explicitly linked catalog-overhead issue; related catalog work addresses distinct boundaries.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep one shared bundled inventory with live-row filtering and early-exit lookups, while preserving the existing hosted loader and installation contracts.

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

Yes, at source level: current main rebuilds complete collections for direct package lookups and eagerly imports download dependencies; the supplied paired probe quantifies the overhead.

Is this the best way to solve the issue?

Yes. The implementation removes unnecessary work at its owner while retaining mutable row identity, selection order, repair hints, and hosted behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 785035327acb.

Labels

Label changes:

  • add P3: This improves bounded metadata lookup and import overhead without evidence of an urgent user-facing failure.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied body records paired runs through actual source and built catalog lookup exports, with matching results, lower lookup time, and fewer loaded modules; this directly exercises the changed owner and appropriately limits the performance claims.
  • 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. Sufficient (live_output): The supplied body records paired runs through actual source and built catalog lookup exports, with matching results, lower lookup time, and fewer loaded modules; this directly exercises the changed owner and appropriately limits the performance claims.

Label justifications:

  • P3: This improves bounded metadata lookup and import overhead without evidence of an urgent user-facing failure.
  • 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. Sufficient (live_output): The supplied body records paired runs through actual source and built catalog lookup exports, with matching results, lower lookup time, and fewer loaded modules; this directly exercises the changed owner and appropriately limits the performance claims.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied body records paired runs through actual source and built catalog lookup exports, with matching results, lower lookup time, and fewer loaded modules; this directly exercises the changed owner and appropriately limits the performance claims.

Evidence

What I checked:

  • Current main still contains the overhead: The catalog, bundled inventory, repair targets, and artifact owner are unchanged between the pinned merge base and fetched main. Main still builds complete catalog collections for direct lookups and imports artifact-download code. (src/plugins/official-external-plugin-catalog.ts, 785035327acb)
  • Latest release retains the original lookup path: The supplied v2026.9.2 release commit imports clawhub-artifacts and uses full catalog listing before package lookup; this optimization is not present there. (src/plugins/official-external-plugin-catalog.ts:1614, 3928bad9badf)
  • Lookup invariants preserved: The iterator filters source references before first-wins deduplication and reads shared rows on each query. Dedicated fixtures cover case-sensitive identities, fresh outer arrays, row mutations, and raw shadowed/source-rejected repair hints. (src/plugins/official-external-plugin-bundled-catalogs.test.ts:99, 1ccfd576e77e)
  • Hosted security and persistence behavior preserved: Read the extracted loader and compared function bodies against the merge-base owner. Hosted fetch guarding, feed verification, expiry handling, rollback checks, snapshot writes, and fallback behavior retain their implementations; the existing entrypoint now imports that owner lazily. (src/plugins/official-external-plugin-catalog-hosted.ts:433, 1ccfd576e77e)
  • Reported production-path measurements: The complete supplied PR body, captured under sourceRevision f95f6a0ee56c74ac16ccb43a9a2764207ac5c9c387ec5dc4b1a884eda1646af7, reports five paired samples through actual source and built package/manifest lookups: median 1001.76 ms to 531.07 ms for 95,000 lookups, matching checksum 475,000, and 255 to 58 loaded built module URLs. It explicitly limits cold-import/RSS observations and discloses increased minor-GC counts. These measurements were not rerun during this read-only review. (1ccfd576e77e)
  • Related work and routing history: Git history and supplied merged-PR metadata connect Peter Steinberger to the earlier source-reference optimization at perf(plugins): prepare catalog source references once per filter #138312. That change prepared source sets within a filter; it did not remove collection rebuilding or the heavy import graph. Deeper follow/blame inspection could not finish because required historical objects were unavailable and remote DNS resolution failed; no source-line introduction is attributed. (src/plugins/official-external-plugin-catalog.ts, 74db4da9de9f)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit 8a540c2 into main Sep 7, 2026
247 checks passed
@steipete
steipete deleted the codex/perf14-bundled-catalog-loading branch September 7, 2026 02:05
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 7, 2026
…137098

* commit '8a540c252002878f3c3e9d8dfb837b83c8602a78': (2210 commits)
  perf(plugins): keep bundled catalog lookups lightweight (#140597)
  refactor: streamline skills JSON serialization (#140581)
  fix(feishu): expand quoted merged-forward messages (#136231)
  fix(talk): keep opaque realtime routes out of public config (#129144)
  fix(ci): avoid Linux packaging on pull requests (#140589)
  fix(usage): release completed request payloads (#140588)
  fix(tooling): omit Trae machine squash credit (#140562)
  fix(ui): stop catalog paging in hidden tabs (#140583)
  fix(portals): reach IPv6 loopback with IPv4-only localhost records (#140580)
  fix(transcripts): preserve fixed and legacy capture history (#140563)
  fix(ui): prevent Talk E2E audio capture stalls (#138803)
  fix(media): release completed document source buffers (#140561)
  fix(anthropic): preserve resumed CLI caches across Git changes (#140566)
  chore(ui): refresh control ui locales (#140586)
  fix(ui): keep usage exports bound to their session instance (#140573)
  refactor(exa): test response readers through tool execution (#140572)
  fix(macos): omit incompatible worker binaries from app bundles (#140557)
  fix: avoid retaining discarded tool output (#140570)
  refactor(gateway): share placement move matching (#140569)
  fix(gateway): preserve child turns during systemd drain (#140568)
  ...

# Conflicts:
#	.agents/skills/release-openclaw-maintainer/SKILL.md
#	docs/reference/RELEASING.md
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
)

Share the typed raw bundled inventory, short-circuit direct lookups, and keep hosted fetching and artifact download code behind their runtime owners. Preserve live row mutation, fresh list arrays, source-reference filtering, conservative raw repair targets, hosted trust/freshness and integrity behavior.

Validated 138 focused tests, full check:changed, full build, and independent isolated P2 autoreview. In an isolated built probe, 95,000 lookups took 531.07 ms instead of 1001.76 ms, and cold import loaded 58 modules instead of 255; these are catalog measurements, not full-Gateway claims.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

Bundled catalog lookups rebuild collections and import hosted download services

1 participant