Skip to content

fix(install): avoid success after incomplete lifecycle changes - #125992

Merged
steipete merged 11 commits into
mainfrom
steipete/distracted-liskov-a47e0f
Aug 19, 2026
Merged

steipete merged 11 commits into
mainfrom
steipete/distracted-liskov-a47e0f

Conversation

@steipete

@steipete steipete commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #125925

AI-assisted change; implementation, tests, and final diff were reviewed before publication.

What Problem This Solves

Fixes an issue where users installing, updating, switching install methods, or uninstalling OpenClaw could receive a success result even though required npm lifecycle work was skipped, Doctor repair failed, the previous working install was removed before its replacement succeeded, or requested cleanup only partially completed.

Why This Change Was Made

The lifecycle is now one canonical prepare → verify → activate → retire → report-success flow. Standalone installers apply npm-version-aware lifecycle approval and verify the package guard is gone; upgrades run Doctor repair before success; install-method transitions preserve and restore the previous owner until the candidate is verified; updater output is delayed until convergence and restart health; and uninstall aggregates every permitted requested cleanup outcome into one final exit status. Plugin-update behavior is intentionally unchanged.

Because standalone installer ordering is public and upgrade-sensitive, this change includes failure-injection coverage across the Bash, rootless, PowerShell, CLI updater, and uninstall boundaries, plus an artifact-bound npm 12 Package Acceptance lane.

User Impact

npm 12 installs reliably run OpenClaw's required lifecycle scripts. Failed upgrades and install-method switches keep the prior runnable installation instead of stranding the operator. Doctor and partial-uninstall failures now produce a truthful nonzero result, and success is shown only after the requested lifecycle work has actually completed.

Evidence

Proof gap: no physical native Windows host was used locally; executable pwsh coverage and exact-head Windows CI passed. The broader optional upgrade-survivor acceptance fixture has a canonical in-flight fix in #126000; the task-relevant exact-head custom profile is green.

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 18, 2026 20:26
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes scripts Repository scripts commands Command implementations size: XL maintainer Maintainer-authored PR labels Aug 18, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 10:48 PM ET / August 19, 2026, 02:48 UTC.

ClawSweeper review

What this changes

The PR makes standalone installation, update, and uninstall commands report success only after required lifecycle work, verification, and cleanup complete.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No concrete patch defect was found. The previous PATH-wrapper blocker is addressed, but this protected lifecycle/upgrade PR should remain open until exact-head package and platform acceptance evidence settles.

Priority: P1
Reviewed head: 265eec697b95d12267de842da27e5ca51414547d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The owner-boundary review and targeted regression coverage support the patch, with exact-head acceptance still needed for merge confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a protected maintainer-authored PR, so contributor-side proof action is not required; exact-head acceptance remains merge validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a protected maintainer-authored PR, so contributor-side proof action is not required; exact-head acceptance remains merge validation.
Evidence reviewed 7 items Wrapper retirement scans every PATH entry: The helper deduplicates PATH locations, verifies an exact legacy wrapper shape, and continues scanning until all matching wrappers are removed.
A retirement failure cannot report success: Post-update finalization converts a wrapper-retirement failure to an error, records failure state, prints the error result, and exits nonzero before success persistence.
Regression coverage for the prior blocker: The test places two exact legacy wrappers in distinct PATH directories, preserves an unrelated wrapper, and verifies both legacy wrappers are removed; it also covers the failure ordering.
Findings None None.
Security None None.

Live Verification

Command: bash scripts/install.sh --help

Result: PASS (completed)

bash scripts/install.sh --helprunner@runnervmzvulz:/tmp/clawsweeper-live-proof-125992-t4gJQX/target$ bash scripts/install.sh --help
bash scripts/install.sh --helpOpenClaw installer (macOS + Linux)

Usage:
  curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- [options]

Options:
  --install-method, --method npm|git   Install via npm (default) or from a git checkout
  --npm                               Shortcut for --install-method npm
  --git, --github                     Shortcut for --install-method git
  --version ‹version|dist-tag|spec›    npm install target (default: latest)
  --beta                               Use beta if available, else latest
  --git-dir, --dir ‹path›             Checkout directory (default: ~/openclaw)
  --no-git-update                      Skip git pull for existing checkout
  --no-onboard                          Skip onboarding (non-interactive)
  --no-prompt                           Disable prompts (required in CI/automation)
  --verify                              Run a post-install smoke verify
  --dry-run                             Print what would happen (no changes)
  --verbose                             Print debug output (set -x, npm verbose)
  --help, -h                            Show this help

Environment variables:
  OPENCLAW_INSTALL_METHOD=git|npm
  OPENCLAW_VERSION=latest|next|‹semver›|‹spec›
  OPENCLAW_BETA=0|1
  OPENCLAW_GIT_DIR=...
  OPENCLAW_GIT_UPDATE=0|1
  OPENCLAW_NO_PROMPT=1
  OPENCLAW_VERIFY_INSTALL=1
  OPENCLAW_DRY_RUN=1
  OPENCLAW_NO_ONBOARD=1
  OPENCLAW_VERBOSE=1
  OPENCLAW_NPM_LOGLEVEL=error|warn|notice  Default: error (hide npm deprecation noise)
Examples:
  curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash
  curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --no-onboard
  curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --no-onboard --verify
  curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method git --version main
  curl -fsSL --proto '=https' --tlsv1.2 https://openclaw.ai/install.sh | bash -s -- --install-method git --no-onboard

runner@runnervmzvulz:/tmp/clawsweeper-live-proof-125992-t4gJQX/target$ bash scripts/install.sh --help










Assertions:

  • PASS expect_output: --install-method

How this fits together

OpenClaw installers and openclaw update prepare a candidate executable, validate lifecycle and Doctor work, activate it, then retire the previous owner. The final CLI result and uninstall exit status are what operators and automation consume.

flowchart LR
A[Install or update request] --> B[Prepare candidate]
B --> C[Verify lifecycle and Doctor]
C --> D[Activate replacement]
D --> E[Retire previous owner]
E --> F[Report final result]
Loading

Before merge

  • Resolve merge risk (P1) - The lifecycle change is upgrade- and availability-sensitive across Bash, PowerShell, and TypeScript owners; exact-head artifact-backed npm 12 and platform acceptance should complete before merge.
  • Resolve merge risk (P1) - The PR also changes package-acceptance automation, so its summary gate must prove the new lane is included and reporting correctly.
  • Complete next step (P2) - Protected lifecycle and installer changes need exact-head package and platform acceptance evidence before a merge decision.
Agent review details

Security

None.

PR surface

Source +150, Tests +1046, Docs +11, Config +62, Other +515. Total +1784 across 31 files.

View PR surface stats
Area Files Added Removed Net
Source 9 246 96 +150
Tests 12 1109 63 +1046
Docs 6 18 7 +11
Config 1 62 0 +62
Generated 0 0 0 0
Other 3 677 162 +515
Total 31 2112 328 +1784

Review metrics

Metric Value Why it matters
Production vs test LOC production +1025/-592 (net +433); tests/support +1135/-780 (net +355); workflow +62/-0 The broad lifecycle transaction change has substantial production growth, so exact-head acceptance evidence is material before merge.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/cli/update-cli/update-command-post-update.test.ts, migration/backfill/repair: test/scripts/install-ps1.test.ts, serialized state: src/infra/package-update-steps.test.ts, serialized state: test/scripts/install-sh.test.ts, serialized state: test/scripts/package-acceptance-workflow.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #125925
Summary: This PR is the candidate repair for lifecycle commands that could report success after incomplete mutation.

Members:

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

Merge-risk options

Maintainer options:

  1. Complete exact-head acceptance (recommended)
    Run the artifact-backed npm 12 installer acceptance and required platform checks against this head before merging.
  2. Accept the remaining platform evidence gap
    Merge using the reviewed shell and PowerShell coverage while explicitly accepting that native platform acceptance is not yet attached.

Technical review

Best possible solution:

Retain the canonical prepare→verify→activate→retire→report sequence and merge only after exact-head npm 12 package acceptance and required platform lanes verify it; no safe shared implementation fits the separate shell, PowerShell, and TypeScript owners.

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

Yes for source: current tests construct two matching legacy PATH wrappers and verify that successful transition removes both, while failure prevents a success result; no external installation was run here.

Is this the best way to solve the issue?

Yes: retirement follows validation and restart work, and a retirement failure becomes a non-success result; a shared transaction layer would not fit the Bash, PowerShell, and TypeScript owner boundaries.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2a469c1cb2e1.

Labels

Label changes:

  • 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: This is a protected maintainer-authored PR, so contributor-side proof action is not required; exact-head acceptance remains merge validation.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: Installer, updater, and uninstall commands can otherwise leave operators with a partial mutation reported as success.
  • merge-risk: 🚨 compatibility: Changing installer lifecycle policy and transition ordering can affect existing npm, Git, and upgrade installations.
  • merge-risk: 🚨 availability: A failure in candidate verification, activation, or cleanup can leave the CLI unusable or only partially repaired.
  • merge-risk: 🚨 automation: The PR adds npm 12 package-acceptance workflow behavior and summary gating that require exact-head validation.
  • 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: This is a protected maintainer-authored PR, so contributor-side proof action is not required; exact-head acceptance remains merge validation.

Evidence

Acceptance criteria:

  • [P1] Artifact-backed npm 12 install acceptance on the PR head.
  • [P1] Required Bash, PowerShell, updater, and package-acceptance workflow checks.

What I checked:

Likely related people:

  • steipete: Current-head blame and the PR-head commit connect this contributor to wrapper retirement and lifecycle finalization. (role: recent area contributor; confidence: medium; commits: 265eec697b95; files: src/cli/update-cli/update-command-git.ts, src/cli/update-cli/update-command-post-update.ts, src/commands/uninstall.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete the exact-head npm 12 package-acceptance lane and attach its result before merge.

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.

History

Review history (7 earlier review cycles)
  • reviewed 2026-08-18T20:57:31.890Z sha 882e353 :: found issues before merge. :: [P2] Continue scanning PATH after unrelated wrappers
  • reviewed 2026-08-18T21:29:26.866Z sha 882e353 :: needs changes before merge. :: [P2] Continue scanning PATH after unrelated wrappers
  • reviewed 2026-08-18T21:59:44.623Z sha 6118e4f6fd9e4a411c2dce51073494c1661d4812 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-18T23:17:18.316Z sha 1a48dda :: needs changes before merge. :: [P1] Verify the Windows npm candidate before accepting lifecycle success
  • reviewed 2026-08-18T23:42:33.785Z sha 4875271 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-19T00:39:03.644Z sha b84018a :: needs changes before merge. :: [P1] Defer Git-wrapper retirement until upgrade verification completes | [P1] Do not overwrite a replacement during wrapper rollback
  • reviewed 2026-08-19T01:45:38.585Z sha 305556a67c373f133899c591e0b7e2e5f2588b60 :: needs changes before merge. :: [P1] Retire all matching legacy Git wrappers

@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 18, 2026
@steipete
steipete force-pushed the steipete/distracted-liskov-a47e0f branch from 64d455d to 1a48dda Compare August 18, 2026 23:09
@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 18, 2026
@clawsweeper clawsweeper Bot added 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. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 19, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready evidence for 265eec697b95d12267de842da27e5ca51414547d:

Focused local proof included:

  • node scripts/run-vitest.mjs test/scripts/install-sh.test.ts test/scripts/install-cli.test.ts test/scripts/install-ps1.test.ts
  • node scripts/run-vitest.mjs test/scripts/install-ps1.test.ts — 42 passed on the final Windows candidate path.
  • node scripts/run-vitest.mjs src/commands/uninstall.test.ts src/commands/cleanup-utils.test.ts
  • node scripts/run-vitest.mjs src/commands/cleanup-live-state.test.ts — 4 passed.
  • node scripts/run-vitest.mjs src/cli/update-cli/update-command-post-update.test.ts — 8 passed on final wrapper behavior.
  • node scripts/run-vitest.mjs src/infra/package-update-steps.test.ts — 24 passed on final staged activation.
  • node scripts/run-vitest.mjs test/scripts/package-acceptance-workflow.test.ts — 194 passed.
  • ShellCheck, Bash syntax, PowerShell parser validation, targeted formatting/lint, and fresh autoreview passes were clean.

Known unrelated gap: the broader optional upgrade-survivor Package Acceptance fixture has a canonical in-flight fix in #126000. The task-relevant exact-head custom profile above is fully green.

@steipete
steipete force-pushed the steipete/distracted-liskov-a47e0f branch from 265eec6 to c4c72e7 Compare August 19, 2026 03:15
@steipete
steipete force-pushed the steipete/distracted-liskov-a47e0f branch from c4c72e7 to 301660d Compare August 19, 2026 03:28
@steipete
steipete merged commit 7bc994a into main Aug 19, 2026
234 of 235 checks passed
@steipete
steipete deleted the steipete/distracted-liskov-a47e0f branch August 19, 2026 03:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 20, 2026
…law#125992)

* fix(install): make lifecycle mutations transactional

Standalone installers now apply npm-version-aware lifecycle approval. Updates verify and repair the installation before reporting success and preserve the prior install owner during method switches. Uninstall now exits nonzero when requested cleanup is only partially completed. Plugin update behavior is unchanged.

Closes openclaw#125925

* test(uninstall): assert aggregated live-owner failure

* fix(install): satisfy standalone shell checks

* fix(update): scan PATH for prior Git wrapper

* test(hooks): await Gmail watcher descendant exit

* fix(install): verify Windows npm candidate

* fix(ci): normalize package acceptance version

* fix(update): preserve staged local package links

* test(update): fold staged symlink coverage

* fix(update): retire every legacy Git wrapper

* test(docs): align consolidated ownership checks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Lifecycle commands can report success after incomplete mutation

1 participant