Skip to content

fix(update): accept a re-linked launcher during the swap and keep triage usable without safe mode - #164438

Merged
steipete merged 1 commit into
mainfrom
upd/upd-homebrew-launcher-backup-and-triage-fallback
Oct 3, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/upd-homebrew-launcher-backup-and-triage-fallback

Conversation

@steipete

@steipete steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes updates aborting when npm/Homebrew re-links an equivalent launcher during rollback verification, followed by recovery triage failing because an older Claude Code lacks --safe-mode.

Discord report: @junior, “Openclaw not working”, 2026-10-03 08:27 UTC. The macOS/Homebrew update to 2026.9.8 passed candidate validation, then failed at Package rollback launcher backup changed: /opt/homebrew/bin/openclaw; Claude triage also exited unsuccessfully.

User Impact

Equivalent launcher links and byte-identical backup shims survive metadata changes. Foreign link targets still refuse before activation and name both expected and actual targets. Older Claude Code runs the saved repair prompt after a visible notice that normal customization settings apply.

The launcher fix belongs to the installed updater. A staged candidate cannot change the checks of an already-running older driver; this PR does not claim to repair that first update hop.

Why This Change Was Made

The existing package-integrity owner compares backup type and content and re-reads symlink targets instead of requiring inode/timestamp immutability during observation. The filesystem owner continues capturing recovery material before activation, preserving supported metadata, and enforcing exact-object authority around mutations. The obsolete ownership-preserved return value is removed; journal encoding is unchanged.

The triage owner checks Claude support in interactive and automatic recovery, retains safe mode where available, and otherwise prints one notice and runs claude -p. Cancellation reaches the automatic capability probe.

Evidence

  • Real isolated global npm 11.19.1 fixture: ino, mtimeNs, and ctimeNs changed while the target stayed ../lib/node_modules/openclaw/openclaw.mjs; backup content differences were empty. Re-linking during observation failed the original swap with Package rollback launcher changed during verification, then committed successfully with the fix. The report did not include its differing-fields suffix, so the fixture establishes the reproduced relink defect rather than the reporter’s exact metadata delta.
  • Regressions failed on baseline for equivalent relinking, foreign-target diagnostics, metadata-only backup restoration, and both old-Claude fallback routes. Existing backup tests retain type/content refusals and now assert both target names.
  • Five touched suites: 170 tests passed 3×, sequentially with one worker, in 73.52 / 60.89 / 51.99 seconds. The repository-supported command was node scripts/run-vitest.mjs <touched files> --maxWorkers=1. After correcting a nullable assertion-message type, the launcher suite passed again (3 tests, 12.31 seconds wall) and its affected TypeScript graph passed.
  • Per-file test time across those passes: launcher 0.391–0.536 s; filesystem 0.434–1.511 s; swap 2.224–5.095 s; triage 6.970–10.325 s; triage recovery 7.098–10.004 s. Slowest individual test: 6.047 s.
  • Importers: 582 tests passed across 21 files, in sequential batches of 15 and 6 (554.76 s / 79.38 s wall). The four test/scripts/ci-node-test-plan*.test.ts suites passed 125 tests in 80.22 s wall for the new regression file.
  • node scripts/check-changed.mjs: exit 0, including all core/test typechecking graphs, lint, dead-export scans, and guards. git diff --check passed.
  • Fresh independent Codex review through P1 on the final tree: scoped clean, no accepted/actionable findings.
  • Numstat: production +39/−30, tests +137/−21, docs +9/−2.

Slow pre-existing suites (waived)

src/cli/update-cli/update-command-original-service.test.ts completed 54 passing tests in 324.315 seconds of test time, separate from shared compilation; the slowest test took 21.010 seconds. This is the pre-existing suite behind the earlier 181-second partial run. Its cost is explicitly waived by the maintainer, and its fixtures are unchanged.

Validation is local under the explicit infrastructure ruling, using isolated fixtures and no operator Gateway/state. Hosted CI timing is not yet available. Auto-merge is off.

Verify rollback launcher backups by content and accept equivalent npm
symlink relinks during observation. Preserve mutation ownership checks
and name both targets when a launcher changes to a foreign target.

Run Claude triage without safe mode with a visible notice when the
installed CLI lacks support, including automatic recovery.

Release-note context: updates tolerate equivalent launcher metadata
changes, and older Claude Code remains usable for recovery triage.
Reported on Discord by junior.
@clawsweeper

clawsweeper Bot commented Oct 3, 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 commands Command implementations size: M labels Oct 3, 2026
@steipete
steipete marked this pull request as ready for review October 3, 2026 17:59
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. 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. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 3, 2026, 2:05 PM ET / 18:05 UTC.

ClawSweeper review

What this changes

The branch tolerates equivalent launcher relinking during updates and lets older Claude Code run recovery triage with a visible notice about normal customization settings.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 3 items remain

The repair remains useful and is absent from current main, but the relaxed launcher comparison can certify rollback after restoring a non-executable shim.

Priority: P2
Reviewed head: 30f577dd28f4bbfada5d696aad5e35189ee05959

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused repair has useful runtime evidence, but rollback executability and the required upgrade check remain unresolved.
Proof confidence 🌊 off-meta tidepool Not applicable: Repository State identifies a trusted MEMBER author, so the external-contributor proof gate does not apply. The body reports real npm relinking through the swap owner with observed after-fix commit success; Claude coverage is supplemental fixture evidence. The required published-driver upgrade check remains separate, and journal encoding is unchanged.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Repository State identifies a trusted MEMBER author, so the external-contributor proof gate does not apply. The body reports real npm relinking through the swap owner with observed after-fix commit success; Claude coverage is supplemental fixture evidence. The required published-driver upgrade check remains separate, and journal encoding is unchanged.
Evidence reviewed 8 items Introduced comparison drops regular-file permissions: The pinned introduced diff removes mode, uid, and gid from launcher comparison for regular files as well as symlinks. Identical bytes therefore pass even when an executable regular-file backup becomes mode 0600.
Rollback propagates the changed mode: Backup capture replaces the original fingerprint with the accepted backup fingerprint. The copy owner preserves the backup file's mode during restoration, and verifyNpmRootRecovery uses the relaxed comparison before declaring recovery verified.
Regression covers harmless metadata changes: The new metadata regression changes the backup to mode 0751 and asserts restored bytes and verified rollback. It does not exercise loss of execute permission. Existing rollback tests establish preservation of regular-file launcher permissions.
Findings 1 actionable finding [P2] Preserve execute permissions when accepting regular-file backups
Security None None.

How this fits together

The package updater captures launcher backups before replacing an installation and verifies them during rollback. Triage turns installation failure diagnostics into a repair prompt for an available coding agent.

flowchart TD
  A[Installed package and launcher] --> B[Capture recovery material]
  B --> C[Verify launcher content]
  C --> D[Activate candidate package]
  D --> E[Verify or restore installation]
  E --> F[Failure diagnostics]
  F --> G[Probe Claude capabilities]
  G --> H[Run repair prompt]
Loading

Before merge

  • Preserve execute permissions when accepting regular-file backups (P2) - Dropping mode for regular files accepts an executable launcher's byte-identical backup even after its mode changes from 0755 to 0600. capturePackageLaunchers then records that backup fingerprint, restoration preserves its changed mode, and verifyNpmRootRecovery uses this same comparison to report recovery verified. The restored openclaw command consequently fails with permission denied. Keep harmless symlink metadata tolerance, but reject or repair loss of required regular-file execute permissions; extend the metadata rollback regression to cover this case.
  • Resolve merge risk (P1) - The required published-driver × candidate upgrade check is not demonstrated; the patched-driver npm fixture does not establish the older updater's first-hop recovery outcome.
  • Complete next step (P2) - Protect regular-file launcher executability when accepting metadata changes and add a failing rollback regression.

Findings

  • [P2] Preserve execute permissions when accepting regular-file backups — src/infra/package-update-integrity.ts:85-86
Agent review details

Security

None.

PR surface

Source +9, Tests +116, Docs +7. Total +132 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 4 39 30 +9
Tests 5 137 21 +116
Docs 2 9 2 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 185 53 +132

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Preserve runnable recovery and verify the upgrade hop (recommended)
    Protect regular-file execute permissions without restoring brittle symlink metadata checks, then record a published-updater-to-candidate recovery result.

Technical review

Best possible solution:

Accept harmless launcher relinking while preserving runnable rollback shims, and demonstrate safe recovery when a published updater installs the candidate.

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

Yes, source establishes the introduced failure: start with an executable regular-file launcher, remove execute permission from its byte-identical backup, and force rollback. No runtime reproduction was executed during this read-only review.

Is this the best way to solve the issue?

Mostly: repairing the existing integrity and triage owners is appropriate, but regular-file executability must remain part of successful recovery.

Full review comments:

  • [P2] Preserve execute permissions when accepting regular-file backups — src/infra/package-update-integrity.ts:85-86
    Dropping mode for regular files accepts an executable launcher's byte-identical backup even after its mode changes from 0755 to 0600. capturePackageLaunchers then records that backup fingerprint, restoration preserves its changed mode, and verifyNpmRootRecovery uses this same comparison to report recovery verified. The restored openclaw command consequently fails with permission denied. Keep harmless symlink metadata tolerance, but reject or repair loss of required regular-file execute permissions; extend the metadata rollback regression to cover this case.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a focused updater and recovery repair with a bounded rollback defect.
  • add merge-risk: 🚨 compatibility: Patched-driver evidence leaves the repository-required published-driver upgrade boundary unverified.
  • add merge-risk: 🚨 availability: The relaxed regular-file comparison can allow rollback to restore a launcher that cannot execute.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Repository State identifies a trusted MEMBER author, so the external-contributor proof gate does not apply. The body reports real npm relinking through the swap owner with observed after-fix commit success; Claude coverage is supplemental fixture evidence. The required published-driver upgrade check remains separate, and journal encoding is unchanged.

Label justifications:

  • P2: This is a focused updater and recovery repair with a bounded rollback defect.
  • merge-risk: 🚨 availability: The relaxed regular-file comparison can allow rollback to restore a launcher that cannot execute.
  • merge-risk: 🚨 compatibility: Patched-driver evidence leaves the repository-required published-driver upgrade boundary unverified.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Repository State identifies a trusted MEMBER author, so the external-contributor proof gate does not apply. The body reports real npm relinking through the swap owner with observed after-fix commit success; Claude coverage is supplemental fixture evidence. The required published-driver upgrade check remains separate, and journal encoding is unchanged.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/infra/package-update-swap.launcher.test.ts src/infra/package-update-swap.test.ts src/infra/package-update-swap.integrity.test.ts src/infra/package-update-filesystem.test.ts --maxWorkers=1.
  • [P1] node scripts/check-changed.mjs.
  • [P1] git diff --check.
  • [P1] Record an isolated published-driver × candidate upgrade/recovery result.

What I checked:

  • Introduced comparison drops regular-file permissions: The pinned introduced diff removes mode, uid, and gid from launcher comparison for regular files as well as symlinks. Identical bytes therefore pass even when an executable regular-file backup becomes mode 0600. (src/infra/package-update-integrity.ts:85, 30f577dd28f4)
  • Rollback propagates the changed mode: Backup capture replaces the original fingerprint with the accepted backup fingerprint. The copy owner preserves the backup file's mode during restoration, and verifyNpmRootRecovery uses the relaxed comparison before declaring recovery verified. (src/infra/package-update-filesystem.ts:493, 30f577dd28f4)
  • Regression covers harmless metadata changes: The new metadata regression changes the backup to mode 0751 and asserts restored bytes and verified rollback. It does not exercise loss of execute permission. Existing rollback tests establish preservation of regular-file launcher permissions. (src/infra/package-update-swap.launcher.test.ts:62, 30f577dd28f4)
  • Current-main necessity: Current main still compares regular-file metadata and refuses interactive Claude launch when safe mode is unavailable. The requested fixes remain distinct from main; the live PR is open and unmerged. (src/commands/triage.ts:434, f7d9a968f278)
  • Verified merge-result ownership: The test merge's raw parents are the pinned base followed by the exact PR head. Comparing that merge against its base retains the introduced launcher comparison change, so the finding survives the three-way merge. (src/infra/package-update-integrity.ts:85, fa35bcf24992)
  • Runtime evidence and upgrade boundary: The captured PR body reports an isolated global npm 11.19.1 fixture: equivalent relinking failed before the fix and committed afterward. It explicitly distinguishes this from the reporter's exact metadata delta and acknowledges that a staged candidate cannot repair an older running updater. No published-driver × candidate compatibility cell is supplied. (30f577dd28f4)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Add a rollback regression where an executable regular-file backup loses execute permission and ensure recovery cannot certify an unusable launcher.
  • Record a published-driver × candidate upgrade result, including the older driver's recovery or manual handoff outcome.

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 f79dac8 into main Oct 3, 2026
197 of 199 checks passed
@steipete
steipete deleted the upd/upd-homebrew-launcher-backup-and-triage-fallback branch October 3, 2026 18:22
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
…age usable without safe mode (openclaw#164438)

On Homebrew-managed installs, openclaw update passed every validation step and then failed the global install swap with 'Package rollback launcher backup changed: /opt/homebrew/bin/openclaw' because npm re-links the bin symlink during install (new inode/mtime, same target) and the launcher backup check compared inode-level identity. The integrity owner now accepts an equivalent relink and compares backup content; a launcher whose target or type changed still refuses with both targets named, so rollback stays restorable. The built-in triage no longer dead-ends when Claude Code lacks --safe-mode: it prints a visible notice and falls back to claude -p. Reported on Discord (#Openclaw not working, junior).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation 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. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant