Repository navigation
fix(plugins): recover missing retained capture directories - #158769
Conversation
Recreate a lost payload directory under its existing native custody lease, without recursively recreating the coordinator parent. Preserve reference counting and advisory cleanup. Refs #158712; thanks @yihan331313.
|
🦞👀 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: needs real behavior proof before merge. Reviewed September 26, 2026, 4:56 AM ET / 08:56 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch lets retained plugin source captures recreate a missing payload directory and adds a regression test and plugin architecture documentation. Merge readiness⛔ Blocked before merge - 4 items remain Keep open. Current main still has the retained-capture ENOENT path, so this is a useful candidate repair for one symptom in the linked Windows report. The prior blocking custody finding remains on the unchanged PR head. Priority: P1 Review scores
Verification
How this fits togetherOpenClaw captures installed plugin source for metadata and model-catalog workers. A retained capture owner allocates temporary directories under a SQLite coordinator lease, and cleanup later reclaims directories whose custody has ended. flowchart LR
A[Installed plugin source] --> B[Retained capture owner]
B --> C[Capture root and coordinator]
C --> D[Payload directory recovery]
D --> E[Captured source]
E --> F[Model catalog worker]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +10, Tests +29, Docs +3. Total +42 across 3 files. View PR surface stats
Review metricsNone. 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: Keep payload-only recovery in the capture owner, but verify that the root and coordinator still match its live native custody before recreating captures; fail visibly when custody is lost. Do we have a high-confidence way to reproduce the issue? Yes for the narrow defect: current main calls mkdtemp under a retained captures directory, so removing that directory before another allocation yields ENOENT. The original cause of its disappearance on the reported Windows host remains unknown. Is this the best way to solve the issue? No, not yet. Recovery belongs in this owner, but the branch must reject a missing or replaced coordinator before making new scratch. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 96e81e68add4. 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
HistoryReview history (1 earlier review cycle)
|
…ort #158414 to 2026.9.7) (#158910) * fix(plugins): recover missing retained capture directories (backport #158769) Recreate a lost payload directory under its existing native custody lease, without recreating the coordinator parent. Required by the native artifact admission backport so captures and native payloads can share one live instance. (cherry picked from commit 4543ce2) Conflict resolution: release/2026.9.7 predates the recovery test file; port only the missing-directory regression, without later main-only cleanup tests. Proof: focused regression passed (1 test, 87 ms; wrapper 2.39 s). Fresh Codex review found no actionable P0/P1 findings. Refs #158712; thanks @yihan331313. * perf(plugins): stop reading native plugin artifacts at startup Reuse installed native admission receipts and retained package payloads across artifacts and generations while preserving companion namespaces, mutable snapshots, worker publication, and install rollback ownership. (cherry picked from commit 9faa93d) Conflict resolution for release/2026.9.7: retain the release catalog-worker protocol, installed-index and lease helpers, and token-bearing cleanup policy. Adapt native footprint coverage to the existing catalog-capture integration suite. Exclude main-only updater extraction and later catalog/cleanup refactors. Reuse the release path-selection logic and extract the unchanged browser-asset predicate. Keep admission preparation and dispatch in a plugin-owned worker module to preserve the state-worker line cap. Prerequisite: #158769, 4543ce2, is backported separately so captures and native directories can share an existing custody lease. Refs #158414 #157815 #158738. Evidence: 18 touched files / 288 cases passed three times; 29 importer shards / 11,150 cases passed, plus 10 live cases. Build, release-base changed checks, and independent P1 review passed on this exact tree. Slow-test follow-up on release/2026.9.7: update-cli.test.ts, owner: CLI tooling; main has #157018. No unrelated test-performance changes are included.
Merge the already-landed release/2026.9.7 history at 7bd08b5 into the reviewed prepared branch without re-cherry-picking external sources. Preserve canonical native admission, companion namespaces, exact-generation fingerprints, worker publication and atomic index ownership alongside the parent's legacy census, cleanup and live lease repairs. Resolve four conflicts and retain both test inventories. A damaged native instance is not tokenless legacy scratch: keep its published payload when the coordinator disappears. Add the existing Doctor journal-history helper to the extracted-wrapper manifest; no database source changes. Canonical provenance remains in the merged history: - #158770 / source #157565 (PollyBot13, landed by Peter Steinberger) - #158808 / source #158323 (Peter Steinberger) - #158910 / sources #158414 and #158769 (Peter Steinberger) Verified 1,019 exact-parent, 82 exact-canonical and nine combined postimages. Two composition regressions reproduced and corrected. 157 focused owner cases and two wrapper closure checks pass, as do production/test types, lint, formatting and all frozen eb377ac ratchets. Full build passed in 262 seconds. Independent P0-P2 review completed all three passes clean. Compilation is not installed-driver qualification. Normal built integration preflight still refused runtime-artifact-publication/systemd-competing-managers. The separate coupled database backport and its bound fixture hunk remain unapplied. Version and dependencies are unchanged; public size-policy hold remains active. Implementation and verification: https://team.openclaw.ai/chat/roboclaw/subagent/69c28824-7ae8-4692-9037-6998b58bc7f4 Discussion, review and integration: https://team.openclaw.ai/chat/roboclaw/dashboard/db4d78ac-b19b-4f64-adfb-0ca7973a62e4 Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: jalehman <[email protected]>
…158769) Recreate a lost payload directory under its existing native custody lease, without recursively recreating the coordinator parent. Preserve reference counting and advisory cleanup. Refs openclaw#158712; thanks @yihan331313.
Closes #158712
What Problem This Solves
Fixes repeated plugin capture
ENOENTfailures after the payload directory of a retained capture instance disappears.User Impact
New plugin and model-catalog captures can proceed under the existing live lease without restarting the Gateway. Previously deleted captured files are not restored. A missing coordinator parent still reports failure rather than creating an unprotected replacement.
Why This Change Was Made
The capture-directory owner created
capturesonly for the first allocation. Later allocations trusted the retained path forever. Recover that missing child once at the same owner, preserving native custody, reference counting, and existing failure cleanup. No configuration, dependency, schema, permission, or updater-driver changes are required. This operates on disposable candidate runtime scratch; existing update backup and rollback behavior is unchanged.The regression reproduces the retained-directory failure, but does not identify what removed the directory on the reporter's Windows host. Initial allocation is synchronous. Existing cleanup guards live leases; the worker/custody suites verify that behavior.
owner.sqliteis intentionally empty, and its lock is separate fromstate-lifecycle. Captures preserve installed package bytes; npm plugin upgrades use a separate owner. No claim is made that this patch resolves the reported npm upgrade or WAL contention symptoms.Catalog failures already publish
catalog-failedandrefreshFailed; failed renewal clears its expiry, and #157459 removed self-scheduling catalog observation. Explicit requests can retry. This patch adds no retry manager or timer.Thanks @yihan331313 for the report.
Evidence
mkdtempwithENOENT; the other eight recovery tests pass.tbx_01m3edfxkgq8wfx2davgzxgsnp, lease run, Node 24.19.0. All direct test importers found by the cross-lane search are included. Three dispatcher wall times: 63.18 s (including cold runtime build), 29.55 s, 26.06 s; individual test time remained below 2 s.a01ac0baf091dcd75bb91b4d5b81f161b7189dde. New regression: 86 ms; dispatcher wall 48.62 s, Vitest 43.96 s (83% transform, 14% tests). This is native Windows capture proof, not a full Scheduled Task installation reproduction.node scripts/check-changed.mjs -- src/plugins/plugin-source-capture-directory.ts src/plugins/plugin-source-capture-recovery.test.ts docs/plugins/architecture.md: passed on the Testbox (core plus all 25 test typecheck graphs, lint, dead exports, and source guards). Full remote command including repeated tests completed with exit 0 in 26m57.581s. No extension-lint substitution was needed.node scripts/run-vitest.mjs src/plugins/plugin-source-capture-recovery.test.ts --maxWorkers=1passed 9 tests; 25.70 s process wall, 22.87 s Vitest (97% transform, about 0.18 s tests). This is the direct test wrapper used to avoid reconciling a shared nested worktree install.