Skip to content

refactor(plugins): reuse immutable installed-index preparation - #140600

Merged
steipete merged 2 commits into
mainfrom
codex/plugin-index-prepared-facts
Sep 7, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/plugin-index-prepared-facts

Conversation

@steipete

@steipete steipete commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Plugin startup and scoped runtime lookups rebuild ownership maps, revisit model matching patterns, and parse the same install ledger even after the installed index belongs to an immutable metadata generation.

Why This Change Was Made

Extend the existing generation-owned installed-index fingerprint cache to retain lookup and parsed install-record facts. Consolidate private ownership-map construction while preserving distinct direct-owner, contribution-owner, and exact installed-ID contracts. Types live in the existing installed-index type owner, keeping the import graph acyclic.

Mutable management indexes remain uncached. Callers retain independent method objects and install-record results, including schema-owned nested values. Configuration, trust, request identity, and lifecycle authority remain evaluated by their existing owners.

User Impact

Repeated reads of an immutable installed inventory do less preparation work. Discovery precedence, setup/runtime modes, configuration, public SDK contracts, and persisted data are unchanged. No end-to-end latency improvement is claimed.

Evidence

  • Original/candidate comparison: six reads of a two-plugin immutable index reduced calls to the already-cached regex compiler from 12 to 2 and install-map parses from 6 to 1. Original preservation assertions passed; the new cost assertions failed as expected.
  • Final startup/scope-selection proof: node scripts/run-vitest.mjs src/plugins/installed-plugin-index-facts.test.ts src/plugins/channel-plugin-ids.test.ts src/agents/harness/runtime-plugin.test.ts — 218 tests passed. Additional discovery/manifest and loader/generation runs passed.
  • Live built-CLI/Gateway proof: node scripts/run-vitest.mjs test/scripts/doctor-config-preflight-plugin-index.built-cli.e2e.test.ts — both isolated stale-index startup and legacy-state restart fixtures passed. Temporary state and free ports were used, and fixture processes were cleaned up.
  • Full pnpm build passed, including all 152 public SDK subpaths and built control-plane/CLI import checks. Madge reported zero cycles; targeted typed lint and complete staged-patch autoreview through P2 passed.
  • node scripts/check-changed.mjs passed on Blacksmith Testbox tbx_01m1wtg15j4z5wdwqfe219tt8n with delegated exit code 0 (backing run). The one-shot lease was stopped after success; its backing workflow can show cancellation during delegated cleanup.
  • Required entrypoint profile on macOS / Node 26.8.1: OPENCLAW_LOCAL_CHECK=0 node --import tsx scripts/profile-extension-memory.mts --extension memory-core --skip-combined --concurrency 1 — 219.25 MiB peak RSS, 39.09 MiB empty-Node baseline, 180.16 MiB import delta, no timeout or failure. This is a candidate import profile, not a before/after Gateway resource comparison.
  • Synced to main 4cf8d68eec01735eab0f5cf1ff7f0b21e74c0329; stable patch ID and all nine changed-file contents match the fully reviewed and tested implementation. Exact-head CI passed at f8631d6fd6262b815ae35220b67dedf1b8c43548.

Production source: 197 additions, 202 deletions, net -5. Tests add 164 lines; docs add 6. Pure type moves contribute no net reduction. No generated files, snapshots, lockfiles, vendored code, or operational tooling are included.

@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 docs Improvements or additions to documentation size: L maintainer Maintainer-authored PR labels Sep 7, 2026
@steipete
steipete marked this pull request as ready for review September 7, 2026 01:53
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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, 11:04 PM ET / September 7, 2026, 03:04 UTC.

ClawSweeper review

What this changes

Reuse prepared plugin ownership lookups, model patterns, and parsed install records across repeated reads of an immutable installed inventory.

Merge readiness

✅ Ready for maintainer review

The optimization remains useful: current main still repeats this preparation. No actionable introduced defect was found, and the protected maintainer PR should remain available for normal landing.

Priority: P3
Reviewed head: f8631d6fd6262b815ae35220b67dedf1b8c43548

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable refactor with relevant preservation coverage and recorded validation; no blocking defect was identified.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate and introduces no material authority change. Its body nevertheless records built CLI/Gateway stale-index startup and legacy-normalization restart success, plus the required build and entrypoint profile; these were not rerun here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate and introduces no material authority change. Its body nevertheless records built CLI/Gateway stale-index startup and legacy-normalization restart success, plus the required build and entrypoint profile; these were not rerun here.
Evidence reviewed 10 items Introduced ownership lookup changes: The pinned merge-base comparison preserves direct-owner, contribution-owner, normalized installed-ID, and model-matching behavior while retaining private lookup closures for immutable indexes.
Caller ownership and schema preservation: Cached install records still pass through the existing parser; returned maps, records, trust-reason arrays, and accepted-surface arrays are copied. The current schema's remaining known fields are scalar, and legacy embedded records retain their existing fallback.
Policy remains outside prepared lookups: Startup callers apply current allow, deny, and enabled settings after resolving inventory owners. Runtime callers use the same lookups to select candidates before the existing loader. No new authorization value, public plugin API, persistent schema, or configuration option is introduced.
Findings None None.
Security None None.

How this fits together

Plugin discovery produces an installed inventory that startup and runtime readers use to select plugins. This change reuses inventory facts while callers continue applying current configuration and policy.

flowchart TD
  A[Installed plugin inventory] --> B{Deeply immutable?}
  B -->|Yes| C[Generation-owned prepared facts]
  B -->|No| D[Prepare fresh facts]
  C --> E[Caller-owned lookups and records]
  D --> E
  E --> F[Current configuration and policy]
  F --> G[Plugin selection and loading]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -5, Tests +164, Docs +6. Total +165 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 7 197 202 -5
Tests 1 164 0 +164
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 367 202 +165

Review metrics

Metric Value Why it matters
Repeated preparation Six reads: compiler calls 12→2; install-map parses 6→1 The reported comparison measures the intended optimization without claiming an end-to-end latency improvement.

Technical review

Best possible solution:

Keep preparation within the existing cache generation, preserve caller-owned results, and continue evaluating mutable policy at its current owner.

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

Not applicable as a bug reproduction: this is an efficiency refactor, and current-main source confirms repeated lookup construction and install-record parsing.

Is this the best way to solve the issue?

Yes. Extending the existing generation-owned cache avoids a competing cache lifecycle and preserves mutable-input and caller-ownership behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 8005f439db70.

Labels

Label justifications:

  • P3: This is a bounded internal efficiency refactor that preserves existing user behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate and introduces no material authority change. Its body nevertheless records built CLI/Gateway stale-index startup and legacy-normalization restart success, plus the required build and entrypoint profile; these were not rerun here.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: 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.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-07T01:52:36.819Z sha 6db9c71 :: needs changes before merge. :: none
  • reviewed 2026-09-07T01:58:56.099Z sha 6db9c71 :: blocked before merge. :: none
  • reviewed 2026-09-07T02:22:01.622Z sha 4c3cb67e122cbd5bf079508053c1646fac9b614c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-07T02:40:05.591Z sha 4c3cb67e122cbd5bf079508053c1646fac9b614c :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/plugin-index-prepared-facts branch from 4c3cb67 to f8631d6 Compare September 7, 2026 02:55
@steipete
steipete merged commit a471ab0 into main Sep 7, 2026
186 checks passed
@steipete
steipete deleted the codex/plugin-index-prepared-facts branch September 7, 2026 03:09
@steipete

steipete commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…law#140600)

* refactor(plugins): reuse immutable installed-index preparation

* refactor(plugins): keep prepared index contracts acyclic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation 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: L 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