Skip to content

fix(update): preserve replaced clone directories - #147544

Merged
fuller-stack-dev merged 3 commits into
mainfrom
fix/update-clone-publication
Sep 19, 2026
Merged

fuller-stack-dev merged 3 commits into
mainfrom
fix/update-clone-publication

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

Related: #144836. Prerequisite for #147562.

What Problem This Solves

A clone destination or staging directory replaced during update validation could be overwritten or recursively removed. Refusing publication also exposed a macOS recovery failure after the previous Gateway had stopped.

User Impact

The clone transaction checks retained directory identities before publication and cleanup, preserving replacements observed at those boundaries. Native recovery commands retain the intended service selectors without inheriting Gateway process-membership markers.

Why This Change Was Made

Keep clone ownership checks in the existing transaction and reuse the updater's existing marker sanitizer for external native commands. Contributor ancestry from @RomneyDa is preserved. This does not claim atomic compare-and-delete protection against arbitrary concurrent filesystem mutations.

Evidence

  • 20 focused clone/snapshot tests passed; the original filesystem replacement regressions remain covered.
  • Two added subprocess regressions failed before the recovery repair; all 25 native-command and executor-custody tests passed afterward.
  • The published 2026.9.4 driver installed the final repaired candidate and reached the exact healthy native LaunchAgent/RPC build. The earlier failed automatic recovery was reproduced before the marker repair.
  • Full final package build and canonical package-integrity validation passed. Real Git/package-derived fixtures exercised staging and destination replacement after actual native service stop: both refused publication, preserved the replaced directories, and automatically recovered the previous native runtime. A fresh clone published, npm-linked, and served the exact expected build.
  • Required exact-head CI passed; an unchanged memory-index lock-contention shard passed on one targeted rerun. API review disposition records the pre-existing residual compare/remove race noted above.
  • Follow-on automatic diagnostics from earlier tests left protected uncertain foreground leases; their installations remain retained for supported reconciliation. No lease deletion or diagnostic-agent cleanup success is claimed.
  • macOS/APFS qualification only; native Windows activation/recovery is not claimed.

@clawsweeper

clawsweeper Bot commented Sep 13, 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 cli CLI command changes size: S maintainer Maintainer-authored PR labels Sep 13, 2026
@RomneyDa
RomneyDa marked this pull request as ready for review September 13, 2026 23:27
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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 Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 18, 2026, 10:05 PM ET / September 19, 2026, 02:05 UTC (Revision 6).

ClawSweeper review

What this changes

The updater preserves clone directories replaced during validation and removes inherited Gateway process markers from native recovery commands while retaining service selectors.

Merge readiness

⛔ Blocked before merge - 3 items remain

This remains useful work: current main and the latest release lack the directory protections. The latest commit addresses the recovery failure observed during validation, but complete recovery qualification remains pending. Maintainer authorship and the protected label also preclude cleanup closure.

Priority: P2
Reviewed head: d8a3f354e66f5acd8f6e6e04078acc4754e102a8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with meaningful regression coverage and no identified blocking code defect; update qualification remains unfinished.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate is exempt for this MEMBER-authored PR. The body provides useful prior-candidate macOS observations, but repository-required published-driver qualification of the latest recovery repair remains a separate merge blocker.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate is exempt for this MEMBER-authored PR. The body provides useful prior-candidate macOS observations, but repository-required published-driver qualification of the latest recovery repair remains a separate merge blocker.
Evidence reviewed 8 items Current main still needs the protection: The current-main clone transaction publishes and recursively removes staging without retaining or comparing directory identities. Comparing the two production files against the reviewed head shows both proposed repairs remain absent.
Latest-release check: The supplied latest release, v2026.9.5, also lacks retained directory identities and performs unconditional staging cleanup when cleanupStaging is true.
Introduced protection and regression coverage: The pinned introduced diff adds identity checks before publication and cleanup. The two filesystem replacement cases assert preservation of replacement contents; existing tests cover successful clones, failed clones, aliases, and failed rollback. No tests were executed during this read-only review.
Findings None None.
Security None None.

How this fits together

When switching to a source installation, the updater validates a staged Git clone before publishing it. Failed updates use the retained installation and native service commands to recover the previous Gateway.

flowchart TD
  A[Source update request] --> B[Stage Git clone]
  B --> C[Validate candidate]
  C --> D{Directory identities match}
  D -->|Yes| E[Publish checkout]
  D -->|No| F[Preserve replacement and refuse]
  F --> G[Recover previous Gateway]
  G --> H[Verify service readiness]
Loading

Before merge

  • Resolve merge risk (P1) - The new refusal can happen after the previous Gateway stops; complete after-fix evidence has not yet shown that this path restores a healthy previous Gateway.
  • Resolve merge risk (P1) - Native Windows behavior remains unqualified: zero directory identities now refuse fresh-clone publication and retain staging, potentially requiring operator recovery.
  • Complete next step (P2) - Complete the recorded published-driver success/refusal reruns after the recovery repair, show previous-Gateway readiness, and resolve the native Windows qualification gap before merge.
Agent review details

Security

None.

PR surface

Source +36, Tests +63, Docs +4. Total +103 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 2 45 9 +36
Tests 2 63 0 +63
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 112 9 +103

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Complete update qualification (recommended)
    Finish the published-driver success and replacement-refusal checks, demonstrate previous-Gateway recovery after the latest repair, and establish native Windows identity behavior.

Technical review

Best possible solution:

Keep ownership checks in the clone transaction and reuse the native-command sanitizer, with published-driver upgrade evidence establishing successful publication and healthy recovery after refusal.

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

Yes, from source: replacing the staged directory during validation reaches current main's unconditional recursive cleanup; the added regression exercises that boundary. This review did not execute the scenario.

Is this the best way to solve the issue?

Yes, the patch extends the existing transaction and reuses the existing environment sanitizer without adding competing owners; full update recovery qualification remains necessary.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 availability: Publication refusal can occur after service shutdown, and complete recovery after the latest repair remains unproven.

Label justifications:

  • P2: This is a bounded updater safety repair for concurrent directory replacement and its recovery path.
  • merge-risk: 🚨 compatibility: The new identity requirements change fresh-clone acceptance, with native Windows compatibility still unqualified.
  • merge-risk: 🚨 availability: Publication refusal can occur after service shutdown, and complete recovery after the latest repair remains unproven.
  • 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 external-contributor proof gate is exempt for this MEMBER-authored PR. The body provides useful prior-candidate macOS observations, but repository-required published-driver qualification of the latest recovery repair remains a separate merge blocker.

Evidence

What I checked:

  • Current main still needs the protection: The current-main clone transaction publishes and recursively removes staging without retaining or comparing directory identities. Comparing the two production files against the reviewed head shows both proposed repairs remain absent. (src/cli/update-cli/shared.ts:325, 9904ad65e096)
  • Latest-release check: The supplied latest release, v2026.9.5, also lacks retained directory identities and performs unconditional staging cleanup when cleanupStaging is true. (src/cli/update-cli/shared.ts:382, ec9c1a13db89)
  • Introduced protection and regression coverage: The pinned introduced diff adds identity checks before publication and cleanup. The two filesystem replacement cases assert preservation of replacement contents; existing tests cover successful clones, failed clones, aliases, and failed rollback. No tests were executed during this read-only review. (src/cli/update-cli/shared.ts:311, d8a3f354e66f)
  • Recovery repair preserves the authority owner: The native-command owner now reuses the existing sanitizer, removing three process-membership markers while preserving service selectors. Executor checks, private child grants, target-root binding, and native authority enforcement remain in place; the patch introduces no dependency, workflow, or package-execution changes. (src/cli/update-cli/update-command-service-command.ts:154, d8a3f354e66f)
  • Captured proof and review continuity: The complete supplied body, captured under sourceRevision 33a5b09387663f73851d0d79060bc5242b70dce47e39f648affc62ccac4e7c01, reports a published 2026.9.4 installation success on the prior candidate and preserved staging replacement followed by recovery failure. It explicitly leaves complete reruns after the latest repair in progress. The live REST body matched this account. Comparison with the previous reviewed head confirms the new service repair and its two subprocess cases; the previous review had no code findings. (d8a3f354e66f)
  • Recovery boundary and repository policy: The Git update owner explicitly handles publication failure after stopping an untouched package service, and service recovery verifies the previous runtime's readiness. Root AGENTS.md requires published-driver × candidate update proof. Native Windows qualification is explicitly unclaimed in the PR body. (src/cli/update-cli/update-command-git.ts:669, d8a3f354e66f)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • fuller-stack-dev: 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 redacted published-driver × candidate results showing normal clone publication and replacement refusal followed by a healthy previous Gateway after the latest recovery repair.
  • Establish native Windows directory-identity and recovery behavior, including the zero-identity refusal case.

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 (5 earlier review cycles)
  • reviewed 2026-09-13T23:34:48.448Z sha f64b19c :: blocked before merge. :: none
  • reviewed 2026-09-13T23:56:27.453Z sha f64b19c :: blocked before merge. :: none
  • reviewed 2026-09-14T00:21:19.385Z sha f64b19c :: blocked before merge. :: none
  • reviewed 2026-09-14T02:31:02.623Z sha c697923 :: blocked before merge. :: none
  • reviewed 2026-09-19T01:47:48.567Z sha f68c7b2 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 13, 2026
@RomneyDa
RomneyDa force-pushed the fix/update-clone-publication branch from f64b19c to c697923 Compare September 14, 2026 02:22
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 14, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Sep 19, 2026
@fuller-stack-dev
fuller-stack-dev merged commit 11e0690 into main Sep 19, 2026
372 of 376 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/update-clone-publication branch September 19, 2026 02:55
@fuller-stack-dev

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
* fix(update): preserve replaced clone directories

* fix(update): keep native recovery commands outside service identity

---------

Co-authored-by: Jason (Json) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation maintainer Maintainer-authored PR 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

2 participants