Repository navigation
fix(update): avoid copying unrelated dependencies during updates - #168927
Conversation
Keep updater runtime hoist discovery within the package manager installation owner. Preserve explicit linked dependency discovery and the existing backup, rollback, and runtime custody checks.
|
🦞👀 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 maintainer review before merge. What this changesThis PR bounds retained updater dependency discovery to the package manager’s installation owner while preserving explicit linked dependencies. Example: An npm installation depends on fixture, whose optional ambient-peer exists only in an enclosing checkout.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR addresses a concrete update failure still present on current main with a focused repair; no actionable correctness or security findings were identified. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherBefore replacing an installation, the update CLI retains its running worker code; package-manager ownership and dependency paths enter the shared copier, which produces a private runtime used until worker settlement. flowchart TD
A[Update CLI] --> B[Installation owner]
B --> C[Retained runtime planner]
C --> D[Bounded dependency discovery]
D --> E[Private runtime materialization]
E --> F[Retained workers]
F --> G[Settlement and cleanup]
Technical reviewBest possible solution: Land the bounded discovery repair through normal repository gates while retaining explicit links and existing integrity, rollback, and worker-settlement guarantees. Do we have a high-confidence way to reproduce the issue? Current-main source shows the unbounded lookup and whole-owner expansion; the supplied baseline observation records failure on an unrelated cache file, but this review ran no reproduction. Is this the best way to solve the issue? The patch fixes dependency selection at its existing owner, preserves explicit external links, and leaves plugin rehearsal callers unchanged. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against eec5e318ecaa. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +11, Tests +75, Docs +6. Total +92 across 4 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 11, 2026, 2:05 AM ET / 06:05 UTC. |
…tion (#168927) Update runtime retention resolved missing optional peers by walking past the installation into ancestor node_modules, retaining entire unrelated dependency trees (394k entries / ~9.2 GB in the measured run). Lookup now stops at the package manager's owning project; linked dependency owners and backup/rollback checks are unchanged. Measured: retention 633 s -> 142 s, update 20m22s (failed) -> 8m54s. (cherry picked from commit 01b25a9)
Re-apply the retainedDependencyRoot hunk of #169292 (032a58b) that was dropped from the earlier #169292 backport because #168927 (01b25a9) was not yet on the branch. With #168927 now applied, the retained dependency root uses resolveIdentityPathViaExistingAncestorSync like the other mutation boundaries, so Windows 8.3 names and case-insensitive volumes do not hide that the update replaces this runtime. Backport notes: follow-up to the backports of #168927 (01b25a9) and #169292 (032a58b); single-line change in src/infra/update-retained-runtime.ts.
…tion (openclaw#168927) Update runtime retention resolved missing optional peers by walking past the installation into ancestor node_modules, retaining entire unrelated dependency trees (394k entries / ~9.2 GB in the measured run). Lookup now stops at the package manager's owning project; linked dependency owners and backup/rollback checks are unchanged. Measured: retention 633 s -> 142 s, update 20m22s (failed) -> 8m54s.
…tion (#168927) Update runtime retention resolved missing optional peers by walking past the installation into ancestor node_modules, retaining entire unrelated dependency trees (394k entries / ~9.2 GB in the measured run). Lookup now stops at the package manager's owning project; linked dependency owners and backup/rollback checks are unchanged. Measured: retention 633 s -> 142 s, update 20m22s (failed) -> 8m54s. (cherry picked from commit 01b25a9)
What Problem This Solves
Fixes minute-scale update runtime retention when optional peers resolve from an ancestor installation. A tiny two-agent state could make the updater retain hundreds of thousands of unrelated development files, and unrelated cache writes could then fail the update.
User Impact
Future updates keep retained runtime dependency discovery inside the package manager's installation owner. Genuine hoisted dependencies and explicitly linked dependencies remain available. Backup, rollback, file-integrity checks, and writer settlement are unchanged. There are no new settings, options, dependencies, or schemas.
The installed updater runs this phase before the candidate takes over, so an older updater cannot benefit on the first update that installs this fix.
Why This Change Was Made
A 2026.10.1 updater copied 394,203 entries with a 9.23 GB estimated footprint while retaining a runtime for two agents, two sessions, and one disabled cron job. Missing optional peers in transitive dependencies found an enclosing checkout's node_modules; discovering one peer retained the entire module owner and its unrelated siblings.
Pass the already-resolved package manager owner into retained runtime discovery and stop ancestor lookups there. Generic plugin rehearsal and explicit links outside that owner keep their existing discovery behavior. The regression exercises npm and pnpm 11 through runtime retention, removes the original installation, and proves a legitimate hoisted dependency still imports while unrelated ancestor packages stay absent.
Evidence
succeeded/finished. Its old CLI subsequently returned exit 1 after a removed cleanup-chunk import; that first-hop limitation is outside this change. The activated Gateway returned readyz 200 and listed both preserved sessions.The isolated after run completed with exit 0, ledger
succeeded/finished, readyz 200, both sessions, the injected durable message, and the authored disabled cron job preserved. Two disabled system heartbeat jobs are also present.These are phase observations, not an additive accounting table. The released run migrated agent schema 24 to 25; the after run started at schema 25, used a warm npm cache, and ran under changing shared-host load. The separately observed unmodified-main failure above used the same target build and restored state as the fixed run. Old-driver exit cleanup spent another 186.9 seconds after its ledger finished; candidate code cannot fix that already-running process.
The under-two-minute target is not met. The largest remaining measured costs are retained-runtime materialization (107.4 s), canary preparation/checks (98.7 s), and package publication (92.3 s). The after timer excludes installing the fixed driver (76.0 s) and removing the prior completed oversized fixture runtime (60.2 s). No backup, rollback, integrity, or live-authority gate was removed to hit a timing goal.
Scope: production +12/−1 lines, regression tests +75, documentation +6. No remote compute was used.