Skip to content

fix(update): avoid ancestor package failures and repeated retries - #163541

Merged
steipete merged 1 commit into
mainfrom
upd/upd-rehearsal-copy-ancestor-resolution
Oct 2, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-rehearsal-copy-ancestor-resolution

Conversation

@steipete

@steipete steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Closes #163486

What Problem This Solves

Fixes candidate Doctor failures when unrelated packages in an ancestor node_modules turn a vendor's undeclared optional import into an outside-copy dependency, followed by repeated expensive automatic update rehearsals.

User Impact

Updates warn and continue for these undeclared ancestor lookups. Declared dependencies and private symlink escapes retain the existing fatal containment check. After two matching automatic candidate Doctor failures, further automatic rehearsals pause until the candidate changes or an operator runs openclaw update.

Why This Change Was Made

Node searches ancestor node_modules directories up to the filesystem root, so changing TMPDIR alone cannot guarantee isolation. This uses mechanism (b): the existing dependency resolver classifies undeclared packages found only outside the rehearsal as unresolvable before acquiring their source. The candidate rehearsal supplies that boundary; ordinary plugin resolution keeps its existing behavior. The existing assertPrivate containment check remains intact, including checks for declared dependencies, optional/peer declarations, and symlink escapes.

Automatic campaign admission reads the last two non-preview update-run records through the existing SQLite reader worker. Matching candidate, reason, and failed-check signatures provide the durable backoff fact without a schema or sidecar. Temporary rehearsal suffixes and elapsed timings do not change the signature. Suppression happens before a new update run or service handoff; the warning includes the recovery command. Manual runs and changed candidates break the matching pair. Unavailable history warns and leaves normal update admission available.

The candidate-side fix recognizes the rehearsal contract already shipped in 2026.9.6. The retry backoff requires a Gateway running the repaired scheduler. Troubleshooting documents both messages. Thanks @iJaack for the diagnosis and reproduction.

Evidence

  • Both new regressions failed on the original production code: the ancestor fixture raised the reported containment error; automatic admission started a third rehearsal instead of stopping after two failures.
  • Published-driver boundary fixture: v2026.9.6 rehearsal path markers are byte-identical to the fixture helper, and its Doctor flags match. Tests cover undeclared ancestor packages, all three dependency declaration kinds, private dependency preference, and existing symlink-escape rejection. Invalid ancestor JavaScript is never parsed.
  • Both touched suites passed three repetitions on the final behavior: 33/33 rehearsal tests and 16/16 campaign tests per run. Final single-worker campaign runner times were 55.71s, 61.35s, and 50.70s; summed test time was 29.33–47.50s on the shared host. These cases exercise real SQLite persistence, worker reopen, and campaign admission; mocks cannot establish durable retry suppression. No Gateway is started by these regressions.
  • All 25 importer files passed: 673/673 tests with node scripts/run-vitest.mjs <importers> --maxWorkers=1, 378.92s runner wall time, including the required build (42.3s). The existing managed-service lifecycle file accounted for 104.46s of test time. After removing a redundant capture-path alias to stay within the existing 700-line cap, the capture and rehearsal owners passed again: 96/96 tests in 27.75s.
  • Single-worker budget runs through the repository wrapper: src/infra/update-candidate-plugin-repair.test.ts passed 33/33 in 13.02s wall; src/infra/update-startup-campaign-run.test.ts passed 16/16 in 50.70s wall (including preparation).
  • node scripts/check-changed.mjs --base 7a62f6ec184f2e2c9dbb7ddd6cc1a848e359531b passed all selected gates, including core and 27 test typecheck graphs, lint, all unused-export scans, and structural guards. Initial line-cap growth, fixture indexing, and lint findings were corrected without suppressions or baseline edits.
  • Independent Codex P1 review: scoped-clean, no actionable findings. git diff --check passes.
  • Production +138/−12 LOC; tests +172/−3; documentation +8. No new modules, exports, dependencies, configuration, CLI flags, or schema.

Validation ran locally on macOS arm64, Node 26.10.0, with isolated fixtures; no live operator Gateway was used. This proves the published-driver rehearsal boundary, not a full installed-version upgrade. CI timing is pending at authoring handoff; auto-merge is disabled.

Treat undeclared ancestor-only plugin packages as unavailable during
candidate inspection while preserving containment for declared dependencies
and private symlink escapes. Use existing update-run history to pause
repeated automatic candidate Doctor failures until the target changes or
an operator retries manually.

Add published-driver rehearsal and durable retry-admission regressions,
and document the warning and recovery path.

Fixes #163486. Thanks @iJaack for the diagnosis and reproduction.
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M labels Oct 2, 2026
@steipete
steipete marked this pull request as ready for review October 2, 2026 13:13
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 2, 2026, 9:18 AM ET / 13:18 UTC.

ClawSweeper review

What this changes

The PR isolates undeclared ancestor package lookups during update rehearsal and pauses automatic retries after two matching candidate Doctor failures.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR remains necessary: current main and the latest release retain the reported ancestor-lookup failure. The introduced changes preserve containment checks, and no actionable patch defect was found.

Priority: P0
Reviewed head: 77ed3ff78f7f5d122bbe04a7236224748d2aeccf

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful boundary regressions and no identified blocking correctness defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied Repository State identifies a MEMBER author, so the ordinary external-contributor proof gate does not apply. Reported boundary regressions exercise the rehearsal owner and SQLite-backed campaign admission; published markers match the fixture, but no full installed-version upgrade was run. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied Repository State identifies a MEMBER author, so the ordinary external-contributor proof gate does not apply. Reported boundary regressions exercise the rehearsal owner and SQLite-backed campaign admission; published markers match the fixture, but no full installed-version upgrade was run. No stored-data contract changes.
Evidence reviewed 9 items Pinned introduction: Reviewed the merge-base-to-head introduced hunks and corresponding production owners and tests. The patch changes rehearsal inspection and campaign admission rather than base-branch work.
Containment-preserving resolver: The boundary is supplied only by candidate rehearsal. Undeclared ancestor packages return unavailable before capture; declared dependency, optional-dependency, and peer-dependency names continue through existing resolution. Rehearsal still asserts lexical and real-path containment, including private symlink escapes.
Durable retry admission: Admission reads two non-preview records through the existing reader worker, matches campaign failures by candidate and diagnostic signature, and rechecks campaign/config validity after awaiting the read. Suppression precedes run creation and service handoff; manual attempts and changed candidates break the pair. Existing CLI adoption preserves the campaign record rather than replacing its trigger.
Findings None None.
Security None None.

How this fits together

OpenClaw rehearses updates against a private copy before replacing the running installation. Plugin dependency inspection validates that copy, while the automatic update scheduler uses recorded outcomes to decide whether another attempt should start.

flowchart TD
  A[Update candidate] --> B[Private rehearsal copy]
  B --> C[Plugin dependency inspection]
  C --> D[Containment checks]
  D --> E[Candidate Doctor result]
  E --> F[Update history]
  F --> G[Automatic retry admission]
  G --> B
  G --> H[Pause with recovery guidance]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +126, Tests +169, Docs +8. Total +303 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 6 138 12 +126
Tests 2 172 3 +169
Docs 1 8 0 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 318 15 +303

Review metrics

Metric Value Why it matters
Production and regression growth production net +126 LOC; tests net +169 LOC Production growth implements bounded rehearsal lookup and history-based admission without adding a schema, configuration option, or parallel state store.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/infra/update-candidate-plugin-repair.ts, serialized state: src/plugins/plugin-package-metadata-capture.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #163486
Summary: This PR is the explicit candidate fix for the reported ancestor-resolution failure and repeated automatic rehearsals.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep rehearsal lookup isolated from unrelated ancestor packages while preserving escape rejection and durable, recoverable retry suppression.

Do we have a high-confidence way to reproduce the issue?

Yes at source level: an undeclared package found in ancestor node_modules enters the rehearsal graph and fails containment on current main. The PR supplies focused regressions; this review did not execute the failure.

Is this the best way to solve the issue?

Yes: the patch repairs dependency acquisition at its existing resolver and derives retry suppression from existing history, preserving ordinary resolution and containment enforcement.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against fc17c21ad7d4.

Labels

Label changes:

  • add P0: The linked report establishes a blocked normal upgrade path whose successful workaround requires manually disabling and restoring plugins.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied Repository State identifies a MEMBER author, so the ordinary external-contributor proof gate does not apply. Reported boundary regressions exercise the rehearsal owner and SQLite-backed campaign admission; published markers match the fixture, but no full installed-version upgrade was run. No stored-data contract changes.

Label justifications:

  • P0: The linked report establishes a blocked normal upgrade path whose successful workaround requires manually disabling and restoring plugins.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied Repository State identifies a MEMBER author, so the ordinary external-contributor proof gate does not apply. Reported boundary regressions exercise the rehearsal owner and SQLite-backed campaign admission; published markers match the fixture, but no full installed-version upgrade was run. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduction: Reviewed the merge-base-to-head introduced hunks and corresponding production owners and tests. The patch changes rehearsal inspection and campaign admission rather than base-branch work. (77ed3ff78f7f)
  • Containment-preserving resolver: The boundary is supplied only by candidate rehearsal. Undeclared ancestor packages return unavailable before capture; declared dependency, optional-dependency, and peer-dependency names continue through existing resolution. Rehearsal still asserts lexical and real-path containment, including private symlink escapes. (src/plugins/plugin-package-metadata-capture.ts:36, 77ed3ff78f7f)
  • Durable retry admission: Admission reads two non-preview records through the existing reader worker, matches campaign failures by candidate and diagnostic signature, and rechecks campaign/config validity after awaiting the read. Suppression precedes run creation and service handoff; manual attempts and changed candidates break the pair. Existing CLI adoption preserves the campaign record rather than replacing its trigger. (src/infra/update-startup-auto-run.ts:277, 77ed3ff78f7f)
  • Regression coverage and validation scope: Read both complete touched test modules. Cases exercise ancestor-package classification, all three declaration kinds, private dependency preference, existing escape rejection, real SQLite persistence/reopen, matching failures, and resume conditions. The captured PR body reports pre-fix failures, repeated passing suites, importer checks, and changed-code gates on macOS arm64. These are contributor-reported results; this read-only review did not execute tests or an installed-version upgrade. (src/infra/update-startup-campaign-run.test.ts:99, 77ed3ff78f7f)
  • Published-driver boundary: Read the published v2026.9.6 rehearsal-path helper through GitHub Contents after its local tag was unavailable. Its environment markers match the current helper used by the regression fixture. This supports the candidate-side recognition contract; it does not establish a full installed-driver upgrade run. (src/infra/update-rehearsal-paths.ts:6, fc17c21ad7d4)
  • Still absent on current main: The fetched main revision retains unbounded ancestor dependency lookup and lacks the matching-failure admission guard. The comparison establishes continuing need, not a claim that merging removes base-branch behavior. (src/plugins/plugin-package-metadata-capture.ts:30, fc17c21ad7d4)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit f1d9422 into main Oct 2, 2026
192 of 193 checks passed
@steipete

steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Landed (squash f1d9422fbd6aca41ae908be2c06a4e5493e2aee8, head 77ed3ff78f7f): lead review scoped-clean (0.8); both suites 3×, 673 tests across 25 importer files, closure/collision/cycle/swap-fixture guards green locally; no failing CI job at merge time. Runtime behavior for an undeclared optional require is unchanged (same as any install without a home-level node_modules); only the scan classification and the auto-update retry policy changed.

@steipete
steipete deleted the upd/upd-rehearsal-copy-ancestor-resolution branch October 2, 2026 13:19
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
…hearsal copy and pause repeated auto-update failures (openclaw#163541)

The candidate rehearsal copy lives under the service TMPDIR (for example ~/.openclaw/tmp), so Node module lookup from inside the copy walks up to the home directory; bundled playwright-core requires an undeclared optional chromium-bidi, which resolved from a home-level node_modules and made the outside-copy containment assertion fail the candidate Doctor on every 2026.9.6 to 9.7 attempt. The dependency scan now classifies an undeclared package that resolves only through an ancestor directory as unresolvable inside the temporary update copy (a warning before source capture); declared dependencies that resolve outside the copy and symlink escapes keep the fatal assertion. Auto-update admission pauses after two matching candidate Doctor failures for the same candidate using the existing SQLite update-run records, with a warning that states the recovery steps; a changed candidate or a manual openclaw update clears the pause. Thanks @iJaack for the diagnosis.

Closes openclaw#163486
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

1 participant