Skip to content

perf: speed up plugin package ownership checks - #136759

Merged
steipete merged 1 commit into
mainfrom
codex/perf-plugin-ownership-path-facts
Sep 3, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf-plugin-ownership-path-facts

Conversation

@steipete

@steipete steipete commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Plugin management listings repeatedly resolve the same installed package path while checking it against the installed inventory. With the bundled inventory present, this adds milliseconds to each prepared listing.

Why This Change Was Made

Reuse the existing realpath helper's map within each synchronous ownership scan, then discard it. The strict package check, lifecycle/orphan check and missing-owner check each retain their own scope. Later calls still observe replaced paths; failed realpath lookups remain uncached.

This also returns the existing missing-owner predicate directly. Production LOC is +16/-16 (net zero); no test or configuration surface is added.

User Impact

Faster plugin management listings with the same package ownership decisions, errors, order and returned identities. No process-wide cache, persistence change or new setting.

Evidence

  • The same 62 canonical tests passed on both source variants, including management, installed manifests, package update and ownership behavior. Full pnpm check passed; independent Codex source review found no actionable P0–P2 findings.
  • Native Node 26.8.1 proof uses real metadata discovery and the complete 151-plugin bundled roster, plus task-owned installed packages. Two fresh correctness hosts precede B0/C0/C1/B1 timing hosts.
  • 502 public calls total: 46 correctness calls and 456 timing calls, including 384 measured samples. Another 78 metadata setup calls are recorded separately. Full outputs, input graphs, property order/flags, aliases, native environment, errors and lifecycle closure are retained and compared.
  • Seventeen explicit controls cover shared children, ambiguous/missing ownership, physical aliases, orphan cleanup, update capture/reconciliation, and retargeting the same alias between calls.
Prepared listing Before median After median Forward change Reverse change
Bundled inventory + one installed package 8.515 ms 6.386 ms -25.01% -27.63%
Bundled inventory + two installed packages / three children 17.901 ms 10.931 ms -38.94% -39.50%

The small installed-only control was +2.02% (+1.17 µs) forward and -11.45% reverse; retained without resampling. Single first-call observations also retain +20.14% on the installed-only control (forward) and +4.29% on the bundled-only control (reverse); these are individual observations, not measured medians. Kernel peak RSS was +0.95% / +0.76%. Both primaries and all protected controls passed the predeclared gates.

These are whole prepared-management-call measurements, not cold CLI, Gateway, network or model-turn latency claims. Setup/import time remains outside each call and inside the bounded host. The original harness attempt stopped before product imports because of a native environment assertion; its evidence and resource charges remain retained. The fresh successor preserves the original rows, counts, gates and caps.

@clawsweeper

clawsweeper Bot commented Sep 3, 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 size: XS maintainer Maintainer-authored PR labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 8:28 PM ET / September 3, 2026, 00:28 UTC.

ClawSweeper review

What this changes

The PR shares realpath results within each plugin ownership scan and restores the existing missing-owner predicate without adding configuration or persistence.

Merge readiness

✅ Ready for maintainer review

No blocking findings. The cache is scoped to each synchronous ownership scan, while current main still performs the repeated resolutions; this focused maintainer PR remains necessary.

Priority: P3
Reviewed head: ace3f9cfb8bb00b5fa92c2d2614ab88784c31319

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-neutral optimization that preserves the existing ownership decision boundary and test-covered semantics.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable for this maintainer-authored PR; the body records after-fix native ownership-scan evidence, and this read-only review independently verified the changed owner boundary and existing behavioral coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable for this maintainer-authored PR; the body records after-fix native ownership-scan evidence, and this read-only review independently verified the changed owner boundary and existing behavioral coverage.
Evidence reviewed 5 items Introduced cache scope: The introduced hunks create a Map once per strict, lifecycle, or missing-owner scan and pass it to each path comparison; no cache crosses a resolver call.
Owner and callers: The missing-owner predicate controls derived registry validation, while management lifecycle work resolves strict ownership before returning a managed plugin result.
Existing behavioral coverage: The installed-manifest test covers orphan records, ambiguous ownership, physical aliases, relation-scoped ownership, and the missing-owner predicate; the PR leaves those assertions unchanged.
Findings None None.
Security None None.

How this fits together

Plugin management validates installed package ownership before registry refreshes, lifecycle actions, and management results proceed. It compares installation records with discovered plugin roots and returns valid, conflicting, or missing-owner outcomes.

flowchart LR
  A[Plugin management request] --> B[Installed plugin inventory]
  B --> C[Ownership scan]
  C --> D[Per-scan path resolution cache]
  D --> E[Ownership decision]
  E --> F[Registry or lifecycle result]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0. Total 0 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 16 16 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 16 16 0

Review metrics

Metric Value Why it matters
Production versus test LOC production +16/-16 (net 0); tests 0 The performance change is production-only and net-neutral, with existing ownership behavior tests retained.

Technical review

Best possible solution:

Keep the cache bounded to each synchronous scan, retaining fresh path observation for later lifecycle calls and the existing ownership test matrix.

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

Not applicable: this PR optimizes a synchronous ownership scan rather than reporting a user-facing failure. Current source directly establishes the bounded cache lifetime.

Is this the best way to solve the issue?

Yes. The ownership scan owns the repeated physical-path facts; a scan-local map removes redundant work without a process-wide stale-path cache, and later calls receive a fresh map.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a focused internal performance improvement with no configuration, API, persistence, or user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

Label justifications:

  • P3: This is a focused internal performance improvement with no configuration, API, persistence, or user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.

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)
  • ToToKr: 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 677b270 into main Sep 3, 2026
208 checks passed
@steipete
steipete deleted the codex/perf-plugin-ownership-path-facts branch September 3, 2026 00:37
@steipete

steipete commented Sep 3, 2026

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

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant