Skip to content

fix(update): keep rolled-back Git installs runnable - #117294

Merged
steipete merged 4 commits into
mainfrom
codex/clawmac-live-qa-20260801
Aug 1, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/clawmac-live-qa-20260801

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where a Git-based update could build the new checkout, fail during doctor or post-build validation, roll source back to the original commit, and then restart the managed Gateway with the newer build output still on disk. That mixed source/build installation could crash-loop instead of recovering the previous working Gateway.

Why This Change Was Made

Git rollback now owns runtime recovery as one transaction. Once a live build has started, it restores the original commit, resolves that commit's package manager, reinstalls dependencies, rebuilds the original runtime, and verifies the build commit, both local build stamps, CLI entry, and Control UI assets against the original SHA. The update result records whether service restart is safe; an unverified recovery leaves the managed Gateway stopped with explicit guidance.

This keeps the existing fast path and preflight build-cache optimization unchanged. Recovery work runs only after a failed mutable update whose live build started.

User Impact

Operators get the previous runnable installation back after a post-build Git update failure. If that recovery itself fails, OpenClaw no longer guesses that restart is safe or starts a mixed installation.

Evidence

  • Reproduced before the fix in a real temporary Git checkout: doctor failure left old source with the new dist marker.
  • node scripts/run-vitest.mjs src/infra/update-runner.test.ts — 66/66 tests passed after rebasing onto current main.
  • New regression exercises new-build success → doctor failure → Git rollback → original dependency install/build → exact original runtime verification.
  • Blacksmith Testbox changed gate passed: core and core-test typechecks, changed-file lint, formatting, dead-export scan, plugin boundaries, import-cycle guard, SQLite/schema guards, and related repository checks. Run: https://github.com/openclaw/openclaw/actions/runs/30690793261
  • Codex autoreview: clean, no accepted/actionable findings.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M maintainer Maintainer-authored PR labels Aug 1, 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. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 5:15 AM ET / 09:15 UTC.

ClawSweeper review

What this changes

The PR makes Git-based update rollback rebuild and verify the original checkout before allowing a managed Gateway restart after a failed live build or validation step.

Merge readiness

⛔ Blocked by patch quality or review findings - 6 items remain

Keep this PR open: it fixes the post-build rollback path, but a failed dependency install can still restart a managed Gateway without rebuilding the rolled-back runtime. The prior P1 concern remains visible at the current head because recovery is armed only after deps install succeeds.

Priority: P1
Reviewed head: bb5eb669a92f406a67aa58dd4dc9a0ce6604f8f8

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and has useful evidence, but the unresolved P1 leaves a mutable update-failure branch capable of restarting an unverified runtime.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: This maintainer-labeled recovery PR describes a temporary-checkout reproduction and focused regression evidence; the external-contributor proof gate does not apply, but the proposed proof does not cover the remaining failed-install branch.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-labeled recovery PR describes a temporary-checkout reproduction and focused regression evidence; the external-contributor proof gate does not apply, but the proposed proof does not cover the remaining failed-install branch.
Evidence reviewed 5 items Dependency-install failure bypasses runtime recovery: The PR runs the mutable dependency install at line 419, returns rollbackError("deps-install-failed") at line 440, and only sets liveBuildStarted at line 442. Consequently, an install failure leaves recovery as source-rollback-safe rather than rebuilding and verifying the prior runtime.
Safe recovery currently permits service restart: The post-update flow restarts the managed Gateway unless recovery.serviceRestartSafe is explicitly false, so the install-failure result above can restart an unverified mixed runtime.
Current main has not independently absorbed this change: There is no diff on the touched update files between the PR base ac2c9847c860c61fac200cfd53052663fe087358 and the supplied current-main commit, so the central repair is not already implemented on current main.
Findings 1 actionable finding [P1] Arm recovery before dependency installation
Security None None.

How this fits together

The update command stops a managed Gateway before changing a Git installation, then the update runner checks out, installs, builds, and validates the candidate revision. On failure, the result returns to the post-update CLI flow, which either restarts the Gateway or deliberately keeps it stopped.

flowchart LR
  A[Managed Gateway] --> B[Update command]
  B --> C[Git checkout update]
  C --> D[Dependency install and build]
  D -->|failure| E[Rollback recovery]
  E --> F[Restart-safety decision]
  F --> G[Gateway restarted or kept stopped]
Loading

Before merge

  • Add real behavior proof - Not applicable: This maintainer-labeled recovery PR describes a temporary-checkout reproduction and focused regression evidence; the external-contributor proof gate does not apply, but the proposed proof does not cover the remaining failed-install branch.
  • Arm recovery before dependency installation (P1) - deps install runs before liveBuildStarted becomes true. If it mutates the candidate checkout and then fails, this branch only restores source, reports restart-safe recovery, and finishUpdate restarts the managed Gateway without rebuilding or verifying the old runtime. This was visible at the prior reviewed head and remains unresolved.
  • Resolve merge risk (P1) - A dependency installation that has already altered the candidate checkout but exits nonzero can roll source back and still restart the managed Gateway without restoring and verifying the old dependency/runtime state.
  • Complete next step (P2) - The repair is mechanically clear, but this PR has the protected maintainer label and should return to its owner for the lifecycle-boundary correction rather than enter an automated replacement lane.
  • Improve patch quality - Set the recovery boundary before the dependency install and retry path.
  • Improve patch quality - Add a regression that simulates a partially mutating failed install, verifies original-runtime rebuild/verification, and proves restart is blocked when that recovery fails.

Findings

  • [P1] Arm recovery before dependency installation — src/infra/update-runner-git.ts:442
Agent review details

Security

None.

PR surface

Source +235, Tests +166. Total +401 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 266 31 +235
Tests 2 166 0 +166
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 432 31 +401

Review metrics

None.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/cli/update-cli/update-command-post-update.test.ts, migration/backfill/repair: src/infra/update-runner.test.ts, serialized state: src/infra/update-runner-git-recovery.ts, serialized state: src/infra/update-runner.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Recover from failed dependency installs (recommended)
    Move the recovery boundary before deps install and prove that any failed mutable install rebuilds and verifies the original runtime before Gateway restart is permitted.
  2. Pause this recovery change
    Do not merge the PR if the broader mutable-install recovery path cannot be covered without expanding the intended update transaction.

Technical review

Best possible solution:

Arm rollback runtime recovery before the first mutable dependency-install attempt, then add a regression that simulates an install failure after mutation and proves the Gateway remains stopped unless the original runtime is rebuilt and verified.

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

Yes, by source: make the candidate revision's dependency install mutate state and then exit nonzero; the runner takes rollbackError("deps-install-failed") before liveBuildStarted is set, and the post-update flow allows a restart.

Is this the best way to solve the issue?

No: recovery is implemented at the right owner boundary, but it begins too late. The recovery marker must cover dependency installation as well as build and post-build validation.

Full review comments:

  • [P1] Arm recovery before dependency installation — src/infra/update-runner-git.ts:442
    deps install runs before liveBuildStarted becomes true. If it mutates the candidate checkout and then fails, this branch only restores source, reports restart-safe recovery, and finishUpdate restarts the managed Gateway without rebuilding or verifying the old runtime. This was visible at the prior reviewed head and remains unresolved.
    Confidence: 0.97
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P1: The affected update failure path can restart a managed Gateway into an unverified runtime, causing a real operator-facing availability regression.
  • merge-risk: 🚨 availability: The patch changes when the managed Gateway restarts after a failed update, and the uncovered install-failure branch can still restart an unsafe installation.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦐 gold shrimp and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-labeled recovery PR describes a temporary-checkout reproduction and focused regression evidence; the external-contributor proof gate does not apply, but the proposed proof does not cover the remaining failed-install branch.

Evidence

What I checked:

  • Dependency-install failure bypasses runtime recovery: The PR runs the mutable dependency install at line 419, returns rollbackError("deps-install-failed") at line 440, and only sets liveBuildStarted at line 442. Consequently, an install failure leaves recovery as source-rollback-safe rather than rebuilding and verifying the prior runtime. (src/infra/update-runner-git.ts:419, bb5eb669a92f)
  • Safe recovery currently permits service restart: The post-update flow restarts the managed Gateway unless recovery.serviceRestartSafe is explicitly false, so the install-failure result above can restart an unverified mixed runtime. (src/cli/update-cli/update-command-post-update.ts:118, bb5eb669a92f)
  • Current main has not independently absorbed this change: There is no diff on the touched update files between the PR base ac2c9847c860c61fac200cfd53052663fe087358 and the supplied current-main commit, so the central repair is not already implemented on current main. (src/infra/update-runner-git.ts:407, f216d3cc868e)
  • Prior finding remains unchanged: The prior completed review identified the same lifecycle boundary; the current-head comparison contains no change to either update-runner-git.ts or the post-update restart logic since 9db219c87f2c8109e0582aedf533d620377fe7bd. (src/infra/update-runner-git.ts:442, bb5eb669a92f)
  • Area provenance: The latest available history for the Git update runner includes the preflight-build-cache work in commit 137050cedd32d469833b18e80f44ef66f216bba3 by steipete, establishing recent ownership of this update path. (src/infra/update-runner-git.ts:407, 137050cedd32)

Likely related people:

  • steipete: Authored the recent Git update-runner preflight work and this PR's recovery implementation, so they have direct context on the update lifecycle. (role: recent area contributor; confidence: high; commits: 137050cedd32, 786c0f9db2a5; files: src/infra/update-runner-git.ts, src/infra/update-runner-git-recovery.ts)

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 (2 earlier review cycles)
  • reviewed 2026-08-01T08:48:01.584Z sha f0def088f56ed039ca00dd5c4873325f4df50099 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-01T09:06:10.278Z sha 9db219c :: needs real behavior proof before merge. :: [P1] Arm runtime recovery before dependency installation

@steipete
steipete force-pushed the codex/clawmac-live-qa-20260801 branch from f0def08 to 3216f0d Compare August 1, 2026 08:57
@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. and removed 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 Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 1, 2026
@steipete
steipete merged commit d88c338 into main Aug 1, 2026
125 of 127 checks passed
@steipete
steipete deleted the codex/clawmac-live-qa-20260801 branch August 1, 2026 09:20
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to Alix-007/openclaw that referenced this pull request Aug 1, 2026
* origin/main:
  fix(update): keep rolled-back Git installs runnable (openclaw#117294)
  refactor(ui): centralize chat outbox projections (openclaw#117284)
  fix(sessions): preserve target rows during legacy migration (openclaw#117272)
  fix(security): detect multiline skill prompt injection (openclaw#117254)
  fix(qa): lease credentials for Telegram startup proof (openclaw#116842)
  refactor(memory): unify session ingestion (openclaw#117293)
  fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621)
  fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292)
  fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* fix(update): restore runtime after git rollback

* chore(update): leave changelog to release automation

* test(update): cover rollback restart policy

* test(update): satisfy caller fixture types
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* origin/main:
  fix(update): keep rolled-back Git installs runnable (openclaw#117294)
  refactor(ui): centralize chat outbox projections (openclaw#117284)
  fix(sessions): preserve target rows during legacy migration (openclaw#117272)
  fix(security): detect multiline skill prompt injection (openclaw#117254)
  fix(qa): lease credentials for Telegram startup proof (openclaw#116842)
  refactor(memory): unify session ingestion (openclaw#117293)
  fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621)
  fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292)
  fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes maintainer Maintainer-authored PR merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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