Repository navigation
fix(install): preserve Git command when npm verification fails - #128502
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 2:03 AM ET / 06:03 UTC. ClawSweeper reviewWhat this changesThe PR keeps the Git-wrapper backup alive through the final npm command probe, restoring the old command if that probe fails, and adds a regression test for that path. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessThis is a focused, source-supported repair for the linked installer rollback bug; no actionable patch defect was found, so it should remain open for normal maintainer merge review. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe POSIX installer can replace a Git-installed flowchart LR
A[Existing Git command] --> B[Create rollback backup]
B --> C[Install npm package and link]
C --> D[Run final npm command probe]
D -->|passes| E[Commit backup and finish install]
D -->|fails| F[Restore Git command]
F --> G[Return install failure]
Before merge
Agent review detailsSecurityNone. PR surfaceTests +84, Other 0. Total +84 across 2 files. View PR surface stats
Review metrics
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 one transaction owner through the final executable probe, then merge this focused repair once exact-head checks confirm the retained installer paths. Do we have a high-confidence way to reproduce the issue? Yes: current source shows the backup is committed before the later failing probe, and the PR supplies a focused parent-failing/head-passing real-shell scenario; this read-only review did not rerun it. Is this the best way to solve the issue? Yes: moving the existing commit to the caller that owns final verification is the narrow canonical repair, avoiding a new fallback path or duplicate transaction. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6ce272c2a662. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
Fixes #127410.
What Problem This Solves
Fixes an issue where users switching a Git installation to npm could lose their working
openclawcommand when the npm package installed but the installer's final CLI verification failed. The installer discarded its rollback backup before that final check, leaving the failed npm link in place.Why This Change Was Made
The outer npm install transaction now owns the command backup through its final
--versionprobe: it restores the previous command on failure and commits the backup only after the probe succeeds.install_openclawstill owns package installation and link publication, but no longer ends a transaction whose final verification belongs tomain.The open same-file changes in #118927, #112754, #110657, and #128407 touch security guards, Git target validation, download timeouts, or explicit Git selection; none changes this backup/final-probe transaction.
User Impact
An npm migration that fails final verification now leaves the previously working Git wrapper restored instead of an unusable npm symlink. Successful migrations still publish and retain the npm command.
Evidence
3cf0c89766ffb372776b6fbb7deee13ea214eb0b6178409d9a0fa9284eb7c5c0c0594cb3b86de102scripts/install.sh+6/-6(net 0)test/scripts/install-sh.test.ts+84/-0Parent reproduction on
055a7302c4a4e11a5233bd5ed3abcfa17f456923:The same production-boundary scenario on this head:
This proof runs the real Bash
mainflow against a temporary HOME, a real executable Git wrapper, a real npm launcher, and an actual filesystem symlink. The third and final npm candidate probe fails; the assertion reads the restored executable from disk and invokes it.Affected sibling checks:
The same-bin success/guard fixture also passed against the parent production code after making its
envcommand hermetic (2 passed), so the fixture adjustment is independent from the production fix.AI disclosure: This change was developed with Codex assistance. The reported failure, owner boundary, competitor state, parent failure, fixed behavior, and commit identity were verified directly.
Limitations: The proof uses a local fake npm executable rather than mutating a machine-wide npm installation or contacting the registry. It exercises the real installer transaction and real filesystem rollback boundary; unrelated tests in this file were not used as evidence.