Repository navigation
improve: reduce repeated plugin package ownership work - #138716
Conversation
Keep capture and replacement reconciliation in separate synchronous resolver lifetimes. Preserve package identity, duplicate child ordering, conflict checks and independent result arrays while removing repeated preparation from internal callers.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 8:43 PM ET / September 5, 2026, 00:43 UTC. ClawSweeper reviewWhat this changesThe PR prepares plugin package ownership once per synchronous operation phase, reuses those facts across management commands, and updates ownership tests without intentionally changing plugin behavior. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this remains a useful optimization absent from fetched main, and no introduced correctness defect was found. The maintainer-authored PR is not a cleanup-close candidate. Priority: P2 Review scores
Verification
How this fits togetherPlugin management maps discovered plugin entries to their installed package and checks conflicting ownership before inspection, consent, update, or removal. The resolver consumes the installed index and package paths, then returns the package owner and its child entries or a diagnostic. flowchart TD
A[CLI and management requests] --> B[Installed plugin index]
B --> C[Phase-local ownership resolver]
D[Package filesystem paths] --> C
C --> E{Ownership consistent?}
E -->|Yes| F[Package owner and child entries]
E -->|No| G[Diagnostic without mutation]
F --> H[Inspect or plan package lifecycle]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +5, Tests +74. Total +79 across 12 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one synchronous, phase-local ownership resolver, recreate it after package replacement or asynchronous work, and preserve existing routing without public API or persistent-cache growth. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is a behavior-preserving performance refactor. Repeated preparation is visible in fetched-main source, but this read-only review did not execute a benchmark or tests. Is this the best way to solve the issue? Yes for the architectural approach: reuse belongs in the existing ownership owner, with separate capture and reconciliation lifetimes, rather than a process cache or caller-specific implementations. Independent verification of the pinned filesystem cache contract remains outstanding. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 726b15fa7b8b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
The remaining dependency-source gap is resolved by direct inspection of the installed, pinned OpenClaw's plugin and infrastructure path-safety modules directly re-export that function. The new ownership resolver creates its private map once per synchronous phase and never exposes it in returned ownership facts. Capture and post-replacement reconciliation construct separate resolvers. Inventory creates its resolver after awaiting catalog loading; one-shot inspection, install, uninstall and consent callers do not carry the resolver across asynchronous work. Successful realpaths intentionally remain stable within that phase; there is no freshness polling or process-wide cache. The resolver also memoizes ownership decisions, including decisions using lexical fallback, so the helper's uncached failures do not imply that a retained resolver observes later filesystem changes. The retained complete ownership suite includes the real-filesystem next-phase replacement case: an initially separate symlink becomes an alias of an existing package, and a new resolver rejects both duplicate package ownership and orphan lifecycle ownership. Existing paired suites and the complete capture/reconciliation study used the pinned installed dependency. These establish the bounded owner contract; they are not an atomic filesystem snapshot or a claim that external processes cannot mutate paths during synchronous execution. The latest exact-head CI aggregate is green for |
|
Merged via squash.
|
* perf: prepare plugin package ownership once per phase Keep capture and replacement reconciliation in separate synchronous resolver lifetimes. Preserve package identity, duplicate child ordering, conflict checks and independent result arrays while removing repeated preparation from internal callers. * test: migrate plugin update fixture to prepared ownership resolver
Additional instructions
Keep Allow edits from maintainers enabled.
What Problem This Solves
Plugin package update planning and reconciliation repeat ownership work as they walk packages and runtime children. That repeated work grows with installed package inventories.
Why This Change Was Made
One resolver now prepares ownership facts for each synchronous phase, replacing the two standalone package/lifecycle resolution paths and repeated scans at internal callers. Capture and replacement reconciliation create separate resolvers; yielding or replacing paths requires a fresh resolver. First-match identity, duplicate-preserving child order, physical-path conflicts, orphan cleanup rules, and fresh returned child arrays stay intact.
Production is +148/−143, net +5 lines. The added factory lifetime replaces repeated preparation across eight internal callers/owners; it introduces no process cache, configuration, SDK, or storage contract. Tests and support are +307/−233, net +74, including a shared typed fixture and ownership-suite extraction.
User Impact
No intended behavior change. The complete capture/reconciliation component is faster on the populated fixtures below, with explicit construction costs on empty and early-error paths. This is not a whole-CLI, management-inventory, Gateway, cold-start, or memory improvement claim.
Evidence
Before/candidate whole-file proof passed the same 333 cases across 18 files, including consent, inventory, owner routing, install/uninstall/update, lifecycle and chat paths. After the test-only extraction, both complete resulting suites passed all 22 moved/retained cases, with byte-identical moved bodies and preserved case names and within-file order. The first normal changed gate failed the registry test's 1,000-line lint limit; its failure is retained. Extracting the two complete ownership cases and sharing the existing typed fixture fixed it without changing ratchets, limits, or production. The successor normal pinned-base gate passed all 30 stages.
Managed Codex P0–P2 review returned scoped-clean, no accepted findings, across three passes (aggregate confidence 0.80). Each pass saw its assigned evidence; the full report retains its per-pass unchanged-caller/dependency context limitations. No reviewer executed product code.
The fixed B0/C0/C1/B1 study times the actual exported capture operation and reconciliation on capture success, including resolver construction on every invocation. It retained 4,694 complete output envelopes, 8,210 exported calls, 512 measured batch means, 372 comparisons, and all 187 adverse comparisons. Full outputs, own-undefined fields and public identity/array-preservation assertions passed. Raw-first arithmetic exactly matched the retained report. That arithmetic auditor also authored the harness; separate source reviewers inspected it.
Sampled tree RSS increased +2.064% / +2.322%; kernel child peaks increased +1.658% / +2.020%. Both include setup, validation and retained evidence, and sampling can miss peaks. The zero-selection row's maximum batch mean regressed +69.521 / +31.182 µs and its first observations +97.792 / +107.792 µs. Empty, missing-owner and bundled-error tails also remain adverse. Every first, warm, matched batch, tail and RSS comparison is retained; none was rerun or removed. Here p95 of 16 batch means equals their maximum, not individual-call p95. There is no aggregate numerical pass threshold.
All six native hosts and the functional/gate processes closed; sources were restored and checked. First observations follow imports/fixture setup and earlier rows, so they are not independently cold filesystem or process samples. Source/dependency binding is selected, not an exhaustive loaded-image inventory. The immutable report digest is
870c605939e952ed887de10edd1d1622dc5df79eb153381d147c4d281f0d9d69.A separate follow-up remains: management inventory historically omits its supplied custom environment when resolving ownership. This patch preserves that behavior; it does not claim to fix it. All nine existing touched files are unchanged between the measured base and inspected main 06759ea. Fresh hosted CI remains required before landing.
CI correction: the first published head exposed a missed test caller of the removed scalar ownership resolver. The existing Docker-probe test now constructs the same canonical phase resolver with its loaded index and fixture environment. Before the correction, the complete file reproduced exactly two failures; after it, all 18 cases pass in the same order. The normal incremental 15-stage gate (including root test typechecking) and independent Codex P0–P2 review passed. This adds no production lines and changes two test lines. All eight production owners and the original measurements remain unchanged. Fresh hosted CI is still required; this local macOS proof is not a claim that the whole prior Linux shard passed.
Current landing evidence: exact-head CI run 33933305230 passed, including the aggregate gate. The pinned fs-safe dependency source and its phase-local cache contract were directly inspected; the review disposition addresses the remaining ClawSweeper dependency gap and rank-up move. No production or numerical result changed.