Repository navigation
fix: avoid rebuilding package-local plugin memory artifacts - #131538
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Pre-land proof for b9a6097. The approved five-file patch is committed unchanged. Readiness and profiling now share the canonical public artifact resolver, removing duplicate root-only discovery while retaining required-build completeness, root precedence, sorted/deduplicated IDs, and TypeScript exclusion. Seven discovery regressions failed before the fix; 104 focused/sibling tests in seven files passed afterward. Changed formatting/types/lint/guards and the full private-QA build passed (64 external plugins, 48 control-plane modules, 147 SDK subpaths). Commands: OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs test/scripts/ensure-extension-memory-build.test.ts test/scripts/profile-extension-memory.test.ts src/plugins/public-surface-runtime.test.ts --reporter=verbose
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs test/scripts/build-external-plugin-local-dist.test.ts test/scripts/bundled-plugin-build-entries.test.ts test/scripts/check-plugin-npm-runtime-builds.test.ts test/scripts/openclaw-performance-source-summary.test.ts --reporter=verbose
node scripts/check-changed.mjs -- scripts/ensure-extension-memory-build.mts scripts/profile-extension-memory.mts test/scripts/ensure-extension-memory-build.test.ts test/scripts/profile-extension-memory.test.ts docs/reference/test.md
OPENCLAW_BUILD_PRIVATE_QA=1 pnpm build
node scripts/lib/plugin-npm-runtime-build.mjs extensions/whatsapp
OPENCLAW_LOCAL_CHECK=0 node --import tsx scripts/profile-extension-memory.mts --extension whatsapp --skip-combined --concurrency 1
node scripts/watch-pr-ci.mjs 131538 b9a6097a7f69210335389fa9e97f0d2bea6fd848CI run 33142845760, attempt 1, completed successfully on this exact head; required openclaw/ci-gate succeeded and the watcher returned Native-import limitation: actual WhatsApp profiling selects Production/tooling +62/-57 (net +5): executable refactoring net -3, plus eight erased type lines narrowing the existing spawn stdio contract. Tests +205/-62; docs +4/-0. No dependency, configuration, schema, or runtime installation-policy changes. Native review artifacts are validated for this head. Live applicable rules require the CI gate, with no enforced reviewer-approval rule. ClawSweeper is still reviewing; its latest comment has no final Rank-up moves to disposition. This is the requested pre-land checkpoint: prepare and merge have not run, and issue #131531 remains open pending the final landing continuation. ClawSweeper review dispositionThe published review found no introduced code or security defect. Its live help check failed before OpenClaw ran because The pending-CI request is resolved by successful exact-head CI run 33142845760 and its required gate. The size request is covered above: executable refactoring is net -3, with eight erased type lines narrowing the existing spawn contract; the shared finder remains the sole discovery flow. Maintainer review has accepted this focused discovery/no-rebuild boundary and its explicitly separate native-import limitation. For the optional after-fix real-setup Rank-up move, these are redacted selections from the saved actual profiler reports (paths made repository-relative): {"profile":"internal","entries":[{"dir":"memory-core","file":"dist/extensions/memory-core/index.js","status":"ok"}]}
{"profile":"standalone","entries":[{"dir":"whatsapp","file":"extensions/whatsapp/dist/index.js","status":"fail"}]}
{"profile":"mixed","entries":[{"dir":"memory-core","file":"dist/extensions/memory-core/index.js","status":"ok"},{"dir":"whatsapp","file":"extensions/whatsapp/dist/index.js","status":"fail"}]}The standalone failure is the recorded |
|
Codex review: needs real behavior proof before merge. Reviewed August 28, 2026, 12:55 AM ET / 04:55 UTC. ClawSweeper reviewWhat this changesThe PR changes the plugin memory profiler and its readiness check to reuse built package-local plugin entry points instead of rebuilding unrelated plugin artifacts. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain Keep open. This is a focused maintainer-authored repair for a current root-only artifact-discovery defect; the proposed shared-resolver path covers both readiness and profiling, and no introduced correctness or security defect was found. Exact-head CI is still running. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe extension memory profiler discovers built plugin entry points, imports them in isolated processes, and reports RSS usage. A readiness check decides whether a build must run before profiling begins. flowchart LR
A[Plugin build outputs] --> B[Artifact resolver]
B --> C[Memory readiness check]
C --> D{Built entries available?}
D -->|Yes| E[RSS profiler]
D -->|No| F[Build profile]
F --> E
E --> G[JSON memory report]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +143, Docs +4, Other +5. Total +152 across 5 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the shared discovery helper after exact-head CI completes, retaining the public resolver as the only artifact-selection policy for readiness and RSS profiling. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: fetched main requires dist/extensions/<id>/index.js for both readiness and enumeration, while the linked scenario supplies only package-local compiled output. This read-only review did not execute the reproduction. Is this the best way to solve the issue? Yes. Reusing the existing per-plugin public-surface resolver removes the two inconsistent root-only decisions instead of adding a plugin exception or another artifact policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2058fd7e91a7. 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
|
|
Merged via squash.
|
Closes #131531 (package-local profiler discovery and unnecessary rebuilds).
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.
What Problem This Solves
Fixes an issue where developers profiling an already-built standalone plugin would trigger an unnecessary
cliStartuprebuild and still fail to select the compiled entry when it lived in package-local output rather than the flat root-dist layout. Unfiltered reports also silently omitted these entries, and the unnecessary smaller rebuild could replace completed private-QA artifacts.Why This Change Was Made
Readiness and profiling now share one built-entry discovery flow that delegates artifact choice to the existing public plugin resolver. It recognizes flat root-dist, nested plugin-local dist, and source-checkout package-local output, preserves root-artifact precedence, deduplicates/sorts IDs, and excludes TypeScript source results. The existing default expected-build inventory and explicit-selection completeness checks remain intact.
This deletes the duplicate root-only enumeration instead of adding plugin-name exceptions, artifact symlinks, loader fallbacks, settings, or dependencies. Plugin runtime/installation policy, build profiles, timeouts, and the report schema are unchanged.
The existing timeout-cleanup test also now waits for a real descendant's readiness before starting its unchanged 250 ms timeout; it no longer confuses slow process startup with cleanup failure. Its existing subprocess seam is typed to the actual ignore/pipe/pipe invocation rather than all Node spawn overloads.
User Impact
Developers can select existing package-local compiled plugin entries without rebuilding unrelated artifacts. Default profiling includes those built entries, and missing native dependencies remain explicit import failures rather than being hidden by a source fallback.
The fresh full root build does not itself supply WhatsApp's index under current build-ownership policy; its existing standalone package builder supplies the package-local artifact. This PR does not change that policy or claim to fix the separate Doctor cold-start investigation.
Evidence
Local proof ran against main baseline
60c1dc35becf066b3e2da379a85abed5b07f2ce9plus this candidate. The affected profiler/build-entry owners remained unchanged when main was rechecked at629a47e3cc20a9f8b6d19c105f840b8a693ec4aa. Exact-head CI passed onb9a6097a7f69210335389fa9e97f0d2bea6fd848: pull_request run 33142845760, attempt 1, and required openclaw/ci-gate succeeded. The repository CI watcher completedGREEN.git diff --check.OPENCLAW_BUILD_PRIVATE_QA=1 pnpm buildpassed, including 64 external plugin builds, 48 control-plane module/Doctor-closure checks, and 147 public SDK subpath checks.extensions/whatsapp/dist/index.jswithout invoking a rebuild. All 15,529 artifact hashes, sizes, timestamps, and symlink targets remained identical before/after. Inventory SHA-256:0d43b5a4efd79a9ee02b0bd86e958ceef83b03fc1cead85476210f610e603e8d.memory-coreprofiling from root dist passed.Focused commands:
Explicit native-import proof gap
The actual WhatsApp report selects the correct package-local artifact and proves no rebuild, but its native import then fails with
ERR_MODULE_NOT_FOUNDfor theopenclawhost package. Repository source-checkout postinstall deliberately removes plugin-localnode_modules; a normal frozen offline dependency installation does not restore that host peer. The full workspace dependency set was restored after the scoped install attempt, and the import was retried with the same result.That pre-existing dependency-setup boundary is recorded separately, not silently fixed through a symlink or TypeScript loader in this PR. A successful WhatsApp native import or Doctor cold-start repair is not claimed. The changed discovery/no-rebuild boundary is covered by both real profiler observations and successful native-CLI fixture imports.
Scope and size
Production/tooling: +62/-57 (net +5). The executable discovery refactor is net -3; eight erased type lines narrow the pre-existing child-spawn dependency to its actual stdio contract. Tests: +205/-62. Docs: +4/-0. No runtime plugin resolver, manifest, package/dependency file, configuration, schema, or persistence contract changes.
Provenance: the automatic root-only readiness check was authored and committed by @vincentkoc in 4ce3c3e on May 28, 2026; GitHub exposes no associated PR. The old layout assumption was carried through the TypeScript migration. The canonical public resolver is the appropriate owner to reuse; a second artifact policy or plugin-specific exception would perpetuate the mismatch.
ClawSweeper review disposition
The published review found no introduced code or security defect. Its live help check failed before OpenClaw ran because
pnpmwas absent in the review environment. The exact commandpnpm test:extensions:memory -- --helpsucceeds in the prepared source checkout (exit 0):The pending-CI request is resolved by successful exact-head CI run 33142845760 and its required gate. The size request is covered above: executable refactoring is net -3, with eight erased type lines narrowing the existing spawn contract; the shared finder remains the sole discovery flow. Maintainer review has accepted this focused discovery/no-rebuild boundary and its explicitly separate native-import limitation.
For the optional after-fix real-setup Rank-up move, these are redacted selections from the saved actual profiler reports (paths made repository-relative):
{"profile":"internal","entries":[{"dir":"memory-core","file":"dist/extensions/memory-core/index.js","status":"ok"}]} {"profile":"standalone","entries":[{"dir":"whatsapp","file":"extensions/whatsapp/dist/index.js","status":"fail"}]} {"profile":"mixed","entries":[{"dir":"memory-core","file":"dist/extensions/memory-core/index.js","status":"ok"},{"dir":"whatsapp","file":"extensions/whatsapp/dist/index.js","status":"fail"}]}The standalone failure is the recorded
ERR_MODULE_NOT_FOUNDfor theopenclawhost peer, not a discovery failure. No rebuild occurred; the before/final inventories contain the same 15,529 artifact records and compare equal. Successful WhatsApp native import remains unproven. No recording is added because this is a terminal artifact-selection repair with real report and preservation evidence, not a UI change. No source changes or redundant re-review request were made.