Repository navigation
perf(doctor): avoid loading unused plugin runtimes - #134541
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 31, 2026, 9:19 PM ET / September 1, 2026, 01:19 UTC. ClawSweeper reviewWhat this changesThe PR extracts Matrix sync-cache persistence from the live Matrix client for Doctor and migration paths, and avoids ACPX claim/runtime work when no legacy session files are present. Merge readinessKeep open. The Doctor import-boundary repair is coherent, but this PR adds a release-owned changelog entry that should be removed; the maintainer label also requires explicit maintainer handling rather than automated cleanup closure. Priority: P3 Review scores
Verification
How this fits togetherDoctor loads plugin migration contracts to inspect and repair old state before the live plugin runs. Matrix cache migration and ACPX session-owner migration now avoid loading their heavier runtime dependencies on no-work paths. flowchart LR
A[Doctor command] --> B[Plugin migration contract]
B --> C[Legacy state discovery]
C --> D{Records found?}
D -->|No| E[Return without runtime import]
D -->|Yes| F[State codec and migration]
F --> G[Plugin state storage]
G --> H[Repair report]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +30, Tests +37, Docs +1, Other -1. Total +67 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single lightweight Matrix cache codec and ACPX no-work return, remove the release-owned changelog line, and land only after exact-head migration coverage is green. Do we have a high-confidence way to reproduce the issue? No independent reproduction was run in this read-only, node_modules-less checkout. The PR body supplies a specific native low-memory scenario and focused regression claims, but hosted exact-head checks are still incomplete. Is this the best way to solve the issue? Mostly yes: extracting the shared persistence codec keeps Doctor off the live Matrix SDK path and the ACPX return is at the discovery owner. Removing the release-owned changelog edit is the remaining narrow correction. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3c23e2fb0eca. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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
HistoryReview history (1 earlier review cycle)
|
00e50f0 to
c105fad
Compare
|
The initial CI failure in the unchanged public Doctor memory case is now addressed by two concrete import-owner repairs: Matrix's migration codec no longer loads the live client, and ACPX does not load its runtime or inspect claims when validated legacy-record discovery is empty. Nonempty ownership checks and all storage semantics remain unchanged. The original, uninstrumented native memory test passes all three cases under the unchanged 256 MiB/180-second limits. All 72 focused tests, the complete build, the composed scoped gate, and independent P0–P2 review passed. The body records exact source/proof limits. Fresh hosted CI is running on @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Final review disposition for exact head The Matrix dependency and migration rank-up is satisfied. I directly inspected installed Exact-head CI 33457932206 is now complete: 126 passed, 16 skipped, zero failed, and required The changelog rank-up is intentionally skipped: the maintainer's explicit instructions for this authorized landing require a one-line changelog entry for user-facing repairs. That task instruction takes precedence over the repository's normal release-only changelog convention. This does not authorize a release, version change, tag, or publication. The prior intermittent cron failure remains unproven as a runtime defect; this PR only improves its timeout diagnostic. Full release certification will come from a new frozen main run after landing, not from these scoped results. |
* test(cron): identify missing model requests in timeout failures * perf(doctor): avoid loading unused plugin runtimes
Doctor's public low-memory import check exposed unnecessary plugin runtime loading. A native Node 24.19 reproduction exhausted the 256 MiB heap after public repairs completed. Same-process heap snapshots then showed 71.82 MiB of retained module/compiler growth, including MatrixClient and the ACP protocol schema. The snapshots force GC and are diagnostic evidence, not a passing memory test or proof of a transcript-data leak.
This repair keeps Matrix's sync-cache codec and persistence operations in one shared owner, separate from the live SDK store class. Doctor and runtime migration use that owner; the live client keeps its existing canonical SDK entrypoint. Chunk keys, version, digest checks, write/delete order, and migration behavior are unchanged. ACPX now returns after its existing filename validation finds no legacy records, before inspecting unrelated claims or loading its runtime. Nonempty records and explicit migration retain all ownership, process-liveness, and incomplete-evidence checks. No plugin is disabled or skipped, and no heap, timeout, fixture, cache lifetime, config, or schema is changed.
The existing cron timeout assertion message remains in this PR. It identifies the missing model-request marker without changing the timeout, polling, or assertion. The earlier cron failure passed independent original-order replays, so this message is diagnostic improvement, not a claimed cron runtime fix. The Doctor repair was added after this PR's initial CI exposed the unrelated memory failure.
Validation so far:
cc9a9ebeb3dcc363bea09575b34eb55d58af171e; the applied candidate tree wasf8c29f2d6673edb20d20a129499c35e0d2fc21e3, with all 35,923 source entries verified before and after. Final reviewed tree092a8ba65cdaef626d4be33bd8a8fa23a873eb78differs only by deleting the obsolete assertion-baseline entry; runtime and test bytes are identical.The complete
pnpm buildpassed all canonical stages in 5m51s, including SDK declarations, 63 external plugin builds, CLI checks, and UI size checks. The complete composed scoped gate passed, including core-test, plugin runtime/test and root-test types, all three lint lanes, Doctor declaration/import checks, ratchets, dead-export scans, and architecture guards. Exact-head CI 33457932206 passed onc105fadc04f00d05c499efa18047b2b49f98cea3: 126 successful jobs, 16 skipped, zero failures; requiredopenclaw/ci-gate99703031131 passed. This is not full release certification; a new frozen full verification follows the main landing. Telegram remains advisory.Production net +30 lines implements the shared Matrix persistence boundary (+27, mostly moved code and required import/assertion documentation) and ACPX's no-work return (+3). Tests net +37, changelog +1, and assertion baseline −1. Broader Memory Wiki/Canvas import cost, Matrix's existing metadata fallback, and crypto snapshot dependency cost remain named follow-up investigations outside this proven boundary.