Skip to content

fix(update): preserve operator work during retained Git rollback - #160170

Merged
steipete merged 17 commits into
mainfrom
fix/r97-forward-3
Sep 28, 2026
Merged

steipete merged 17 commits into
mainfrom
fix/r97-forward-3

Conversation

@steipete

@steipete steipete commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

After a Git-checkout update completes and its transaction is retained, a later rollback checked source cleanliness once and then ran reset --hard, clean -fd, checkout --force, another reset --hard and branch -D. Operator edits made while the rollback awaited (tracked, untracked or staged) were destroyed, an operator-recreated or moved dev branch was deleted, and the checkout could land on the wrong lineage. Separately, prepareGitRuntimePromotion().restore() re-checked authority after the rename but before recording completion, so a restore that finished and then lost authority could be replayed and delete the restored runtime (latent today because the only caller is memoized).

Both corrections were made on the abandoned release/2026.9.7 branch during review of 008d0c4 and never reached main; this forward-ports them before that branch is deleted.

Summary

  • Branch custody is held through the final ref write instead of probed before it. A rollback that must move the checkout's own branch stays attached to it and uses git checkout --no-overwrite-ignore -B <branch> <beforeSha>: while this worktree holds the branch, Git refuses any other worktree's checkout, worktree add, branch -f, rebase or bisect of it, so the earlier probe-to-update-ref window is gone. Porcelain checkout also refuses to overwrite ignored or untracked files (a review showed read-tree -m -u does overwrite ignored files). checkout -B has no old-SHA check, so the step verifies the branch reflog transition (<branch>@{1} must be the activated SHA, the branch must be beforeSha) and otherwise fails closed with the concurrently written SHA and recovery commands; the previous runtime is retained.
  • A dev branch created by the update is kept on retained rollback, with a recoverable-maintenance advisory naming its creation SHA and a quoted git branch -d hint. Autoreview showed no Git primitive can exclude a linked worktree that is mid-checkout of that branch, and a post-delete repair can be stranded by authority loss, so deleting it could still orphan another worktree. The non-retained path keeps its prior branch -D.
  • Retained rollback re-verifies source state before and after every step, advances only to the planned SHA/branch, never force-resets or cleans for retained transactions, uses non-forcing checkout (staged content in unchanged files is preserved; a review finding showed reset --keep still discarded it), and never deletes the created dev branch in the retained path.
  • Runtime restore checks authority before the rename and records completion before the post-check.
  • Rollback steps move into update-runner-git-steps.ts and the retained-transaction cases into update-runner-git-transactions.test-support.ts to stay within line caps (no cap changes).

Evidence

  • Linked-worktree regressions (checkout and paused-bisect claims, for both delete and rewrite): 4 cases pass; retained-rollback selection 17 passed (single run ~70 s wall under host load; individual real-Git cases 3-6 s).

  • Baseline on unchanged main: 11 of the new retained-rollback cases failed (plus the runtime replay case); two controls passed.

  • After the fix: 77 update-runner-git tests passed, including all 13 retained-rollback cases and the runtime replay case. 12 existing cases that failed intermittently during a loaded local run also pass on pinned origin/main in isolation (host load, not this change).

  • Line-cap gates pass; pnpm check:changed otherwise did not finish locally under host load, so the remaining lanes are covered by this PR's CI.

  • Autoreview (branch mode): first round found the staged-content case (fixed, with regression); final round scoped-clean.

Final-effect proof (real Git, redacted)

Git 2.54.0; synthetic update fixtures through the real retained transaction (dev is main in these fixtures).

PROOF rewrite late claim refused   (claim injected immediately before checkout -B; Git refuses it)
$ git rev-parse refs/heads/main     -> 8ea54fd39adf... (beforeSha)
$ git symbolic-ref HEAD             -> refs/heads/main
$ git worktree list --porcelain     -> only <tmp>/checkout, branch refs/heads/main

PROOF created dev branch kept
Kept branch main created by this update at 87ffe0baac33.... Once no worktree uses it, remove it with: git branch -d main
$ git symbolic-ref HEAD             -> refs/heads/operator-branch   (original checkout restored)
$ git rev-parse refs/heads/main     -> 87ffe0baac33... (activatedSha, kept)

PROOF ignored file refused; operator content preserved
source restoration refused, operator's ignored file unchanged, activated runtime and previous-runtime backup retained

Validation (head ecf3cc5)

  • Before the keep-branch change, its new test failed for both initial lineages (the branch had been deleted): 2 failed, 13.5 s.
  • node scripts/run-vitest.mjs run src/infra/update-runner-git-candidate.test.ts src/infra/update-runner-git-runtime.test.ts --maxWorkers=2: 100 passed, 240.9 s wall locally (real Git fixtures dominate).
  • pnpm tsgo:core, core infra test typecheck, targeted oxlint, oxfmt, git diff --check: pass.
  • Autoreview (branch mode, P1, with update-runner-git.ts as context): scoped-clean on the final head; the previous round's two delete-path P1s are resolved by keeping the branch.
  • Production lines vs pre-PR main: update-runner-git-steps.ts 53 -> 265, update-runner-git.ts 700 -> 657 (net +169); the growth is the extracted rollback steps plus custody-preserving checkout and reflog verification.
  • Merged current main before the final commits (no conflicts).

Review round 4 (f65bc60)

  • Recovery guidance no longer risks discarding a newer operator ref: a git branch -f restore is only suggested when the branch still points at the rollback commit and the reflog shows a raw writer moved it before the rewrite; when someone wrote after checkout -B, the message reports the expected and observed SHAs and asks the operator to inspect git reflog <branch> and keep the newest intended commit.
  • A usable branch reflog is now required before the rewrite (git reflog exists + <branch>@{0}); without one, rollback refuses before touching the source (previous runtime retained) instead of refusing after the rewrite.
  • Real-Git final-effect proof (Git 2.54.0, synthetic fixtures through the retained transaction, paths redacted): raw writer via git update-ref immediately after checkout -B -> rollback step fails closed, branch and HEAD stay at the operator's commit c7d2457, reflog shows main@{1} = the rollback reset, stderr contains no branch -f suggestion, active runtime and previous-runtime backup retained. Reflog disabled (core.logAllRefUpdates=false, branch reflog removed) -> refused before mutation: branch/HEAD still at the activated commit, source unchanged. Both regressions failed before the fix; the raw-writer-before control keeps its safe restore guidance.
  • 101 tests across the candidate/runtime files pass; core and infra test typechecks, targeted lint, format pass; autoreview (branch mode, P1): scoped-clean.
  • Published 2026.9.6 updater x candidate cell: runs with the combined post-merge Package Acceptance on main (P5 fix(doctor): prevent plugin load errors after read-only inspection #160446 has landed), per maintainer decision; the release Full Release Validation runs the same cell on the re-cut branch.

Known edge (accepted)

Retained rollback refuses (before touching the checkout, previous-runtime backup kept, Gateway left stopped with guidance) only when branch reflogs are disabled and the branch reflog was deleted. Restarting the previous runtime alone is not safe here because plugin discovery and artifact fallback still read tracked candidate inputs from the checkout; see the PR comment for details. Follow-up for the update owner: retain all previous runtime inputs (or verify tracked inputs) so a checkout refusal can still bring the previous Gateway back.

Release note: Git-checkout updates no longer discard operator edits or rewrite/delete branches another worktree owns during rollback; a dev branch created by a failed update is kept with a cleanup hint.

Forward-port rollback-ownership and runtime-restoration corrections from 008d0c4. Preserve operator edits and changed branch refs, and record completed runtime restoration before rechecking authority. Validation remains incomplete under host load; do not publish.
Keep retained Git rollback ownership and runtime restore replay fixes within existing file limits. Move rollback commands to the Git step owner and transaction regressions to sibling test support; preserve the original regression coverage. Completes the implementation extraction from 7d8c28f; validation and review are recorded in the PR.
Replace retained reset --keep with a non-forcing detached checkout, conditional branch-ref update, and reattachment. The old reset discarded staged content in unchanged files when the working copy contained a different edit. A real-Git regression reproduced the index losing the staged bytes before this fix.
@clawsweeper

clawsweeper Bot commented Sep 28, 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.

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 28, 2026
@clawsweeper

clawsweeper Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 28, 2026, 2:24 PM ET / 18:24 UTC (Revision 12).

ClawSweeper review

What this changes

The branch changes Git-checkout rollback to preserve operator edits and branch custody, prevents replay of completed runtime restoration, adds real-Git regressions, and documents recovery.

Merge readiness

⛔ Blocked before merge - 4 items remain

Current main still has the destructive Git rollback path, so this PR remains useful. The prior code findings are addressed, but the reflog-less recovery tradeoff needs an update-owner decision and the required published-updater upgrade result is still absent.

Priority: P1
Reviewed head: 6524c79e2905e622db4887dd9541fafff2d46ebe
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The owner-level repair has useful real-Git proof, while first-hop upgrade evidence and the reflog-less availability choice remain unresolved.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body reports Git 2.54.0 runs through the changed retained transaction with synthetic checkouts: a late worktree claim is refused, a post-checkout ref write retains the operator ref and runtime backup, and a missing reflog refuses source mutation. The published 2026.9.6 updater × candidate cell remains a separate upgrade-proof gap; no stored-data contract changes.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body reports Git 2.54.0 runs through the changed retained transaction with synthetic checkouts: a late worktree claim is refused, a post-checkout ref write retains the operator ref and runtime backup, and a missing reflog refuses source mutation. The published 2026.9.6 updater × candidate cell remains a separate upgrade-proof gap; no stored-data contract changes.
Evidence reviewed 11 items Current main still needs the repair: The rollback path still runs hard reset, clean, forced checkout, another reset, and dev-branch deletion.
Current-main comparison: The affected updater source and documentation have no diff between the pinned PR base and fetched current main; the introduced rollback is not already on main.
Reflog-dependent rollback: The introduced retained rollback checks for a usable branch reflog before checkout rewrites the ref and reports refusal when it is unavailable.
Findings None None.
Security None None.

How this fits together

The installed updater builds and activates a Git checkout, then retains the previous checkout and runtime until verification finishes. If verification fails, rollback restores source and runtime before the Gateway can safely restart.

flowchart LR
  A[Installed updater] --> B[Git checkout activation]
  C[Operator edits and worktrees] --> D[Retained rollback]
  B --> D
  D --> E[Branch and reflog checks]
  E --> F[Source and runtime restoration]
  F --> G[Gateway restart or manual recovery]
Loading

Decision needed

Question Recommendation
Should retained rollback on a Git checkout without a usable branch reflog refuse source restoration and leave the previous runtime backup for manual recovery? Accept the fail-closed rule: Keep the documented refusal and retained backup after the update owner explicitly accepts the recovery burden and the published-driver cell passes.

Why: The reflog check protects branch-ref integrity but changes upgrade behavior for existing checkouts and can leave a stopped Gateway awaiting operator action.

Before merge

  • Resolve merge risk (P1) - An existing checkout without a usable branch reflog now refuses retained rollback after activation. The previous runtime is retained, but the Gateway can remain stopped until an operator recovers it; explicit update-owner acceptance of this upgrade behavior is not visible in the captured discussion.
  • Resolve merge risk (P1) - The PR defers the repository-required published 2026.9.6 updater × candidate cell until after merge. No result yet establishes the first update hop for existing installations.
  • Complete next step (P2) - Obtain the update owner's reflog-less recovery decision and the published 2026.9.6 updater × candidate result before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +197, Tests +434, Docs +4. Total +635 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 278 81 +197
Tests 4 648 214 +434
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 930 295 +635

Review metrics

Metric Value Why it matters
Production and regression growth production +197 net lines, tests +434 net lines The production growth has a stated purpose: extracting rollback steps and adding branch-custody checks exercised by real-Git regressions.

Merge-risk options

Maintainer options:

  1. Accept reflog-less refusal (recommended)
    The update owner can accept manual recovery for reflog-less checkouts once the published-driver upgrade result is available.
  2. Provide a safe fallback
    Keep the PR open for a reflog-independent rollback path with real-Git proof for concurrent ref writes and operator files.

Technical review

Best possible solution:

Keep one rollback owner that preserves operator source work, retains the previous runtime when restoration is unsafe, and gives operators a clear recovery path for checkouts that cannot be restored automatically.

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

Yes, from source: current main still has the destructive rollback sequence, and the PR reports pre-fix failures in real-Git cases. This read-only review did not execute the path.

Is this the best way to solve the issue?

Yes in principle: the patch repairs the existing rollback owner and tests Git's actual branch behavior. The reflog-less policy and first-hop upgrade evidence remain merge decisions.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Retained update rollback affects operator source work and recovery of a stopped Gateway.
  • merge-risk: 🚨 compatibility: The new reflog prerequisite changes rollback behavior for existing Git checkouts.
  • merge-risk: 🚨 availability: A refused rollback after activation can leave the Gateway stopped pending manual recovery.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body reports Git 2.54.0 runs through the changed retained transaction with synthetic checkouts: a late worktree claim is refused, a post-checkout ref write retains the operator ref and runtime backup, and a missing reflog refuses source mutation. The published 2026.9.6 updater × candidate cell remains a separate upgrade-proof gap; no stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body reports Git 2.54.0 runs through the changed retained transaction with synthetic checkouts: a late worktree claim is refused, a post-checkout ref write retains the operator ref and runtime backup, and a missing reflog refuses source mutation. The published 2026.9.6 updater × candidate cell remains a separate upgrade-proof gap; no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Patrick Erichsen: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Lehman: 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.

  • Capture the published 2026.9.6 updater × candidate result for the reviewed change.
  • Record the update owner's decision on reflog-less recovery and its operator guidance.

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 (11 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-28T11:37:31.775Z sha dbc46a9 :: needs real behavior proof before merge. :: [P1] Preserve a later operator ref in recovery guidance
  • reviewed 2026-09-28T12:30:21.251Z sha f3573c3 :: needs real behavior proof before merge. :: [P1] Preserve a later operator ref in recovery guidance
  • reviewed 2026-09-28T13:25:33.949Z sha a2267cf :: needs real behavior proof before merge. :: [P1] Preserve a later operator ref in recovery guidance
  • reviewed 2026-09-28T15:46:31.811Z sha 2296b06 :: needs real behavior proof before merge. :: [P1] Preserve a later operator ref in recovery guidance
  • reviewed 2026-09-28T16:25:45.632Z sha 952aa1d :: needs real behavior proof before merge. :: [P1] Preserve a later operator ref in recovery guidance
  • reviewed 2026-09-28T16:35:16.136Z sha 43b344f :: needs real behavior proof before merge. :: [P1] Preserve a later operator ref in recovery guidance | [P2] Check reflog availability before rewriting the branch
  • reviewed 2026-09-28T17:08:34.323Z sha 7325bb6 :: needs real behavior proof before merge. :: [P1] Preserve a later operator ref in recovery guidance | [P2] Check reflog availability before rewriting the branch
  • reviewed 2026-09-28T18:01:18.370Z sha f65bc60 :: blocked before merge. :: none

…hanges

Linked worktrees in a paused rebase or bisect detach HEAD, so worktree porcelain misses their branch reservation. Probe with a no-op branch reset, which Git refuses for every worktree owner state.
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XL and removed size: L labels Sep 28, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Status: two ClawSweeper/autoreview P1 rounds on branch custody were fixed (porcelain check, then Git's native no-op branch -f probe covering rebase/bisect reservations). The remaining P1 is the probe-to-update-ref window and the fail-closed rewrite outcome, which need either a different primitive (e.g. letting Git perform the final ref change with its own custody check) or an explicit maintainer decision. Leaving this open for the update owner rather than iterating further in this forward-port pass.

steipete added a commit that referenced this pull request Sep 28, 2026
Chat transcript tool-card disclosure toggles call the current render lifecycle's update hook (rebound on every projection without repainting cached rows) instead of the closure captured when the row was first rendered. Latent hardening; no visual change.

The session-roster-request-rate real-gateway e2e failure seen on this PR also fails on unrelated PRs today (e.g. #160170) and is not caused by this change.

Forward-port of release/2026.9.7 0c06877 and a124ea0.
Keep HEAD attached during retained source restoration and verify the reflog transition before restoring the runtime.

Restore claimed dev refs with create-only compensation after CAS deletion. Preserve operator edits and report explicit recovery steps.
Leave the created dev ref intact during retained rollback and report a quoted manual cleanup hint while restoring the original checkout and runtime.

Remove post-delete custody scans and compensation, which cannot exclude in-flight claims or safely repair after authority revocation. Preserve the existing rewrite and non-retained cleanup paths.
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 28, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

CI note for run 36427635465 (head a2267cf): the only failure was ui/src/e2e/chat-motion.e2e.test.ts > animates new prompts without hiding streamed replies on desktop (expected 2 to be greater than 2), outside this PR's diff and seen once on main today. Rerunning the failed jobs once under the maintainer flake policy; a recurrence anywhere is treated as a main regression and fixed on main.

@steipete

Copy link
Copy Markdown
Contributor Author

CI note for run 36445218914 (head 2296b06): the only failure was ui/src/e2e/model-catalog-partial-refresh.e2e.test.ts > keeps usable effort controls when the selected model is locked during a partial refresh (expected 'true' to be 'false'), outside this PR's diff and seen once on main today (logged). Rerunning the failed jobs once under the maintainer flake policy; a recurrence anywhere is treated as a main regression and fixed on main.

@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 Sep 28, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Sep 28, 2026
Require an existing, readable branch reflog before retained rollback rewrites
source. If the ref changes after checkout, retain both runtimes and report the
expected, current, and reflog-previous commits without a forced-ref command.
Only offer conditional restoration of an overwritten earlier write while the
branch still points to the rollback commit.

Extend the real-Git transaction table with the post-checkout writer and
pre-mutation reflog refusal, and document the installed-updater behavior.
Both regressions fail against the previous implementation; the existing
pre-checkout writer recovery remains covered.

Validation: 101 candidate/runtime tests pass (176.9s wall); core and infra-test
typechecks, targeted oxlint, oxfmt, and git diff --check pass. The three focused
real-Git cases take 6.4s test time on one worker. Isolated P2 review is clean.
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 28, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

CI note for run 36463778760 (head 6524c79): the only failure was ui/src/e2e/chat-markdown-table-interactions.e2e.test.ts > sizes desktop tables to content while preserving mobile layout and expanded he... (expected false to be true), outside this PR's diff and seen once so far (logged). Rerunning the failed jobs once under the maintainer flake policy; a recurrence anywhere is treated as a main regression and fixed on main.

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer decision on the reflog-less refusal (relayed for Peter, 2026-09-28): accepted as a fail-closed edge. It only occurs when branch reflogs are disabled (core.logAllRefUpdates=false) AND the branch's existing reflog was deleted; without a reflog the rollback cannot verify the checkout -B rewrite, so it refuses before touching the checkout and keeps the previous-runtime backup.

Why the previous Gateway is not restarted in that path: restoring only the backed-up runtime while the checkout stays at the activated commit is not a coherent previous generation. The runtime backup holds generated directories, but plugin discovery still reads the tracked candidate plugin manifests from the checkout (src/plugins/discovery.ts), which drive config validation, and runtime artifact selection can fall back to candidate source when a previous compiled entry is missing (src/plugins/plugin-runtime-artifact-selection.ts). That could start a mixed old/new generation despite a correct previous build-info SHA. Doing this safely needs the transaction to retain all previous runtime inputs or verify the remaining tracked inputs, which is a larger follow-up for the update owner. The refusal message names the branch, the SHAs, and what to inspect.

@steipete
steipete merged commit a8932f5 into main Sep 28, 2026
413 of 420 checks passed
@steipete
steipete deleted the fix/r97-forward-3 branch September 28, 2026 19:28
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

Copy link
Copy Markdown
Contributor Author

Post-merge published-driver proof: Package Acceptance run 36482095098 on main 165fd29 (contains this PR and #160164/#160170) passed both Docker lanes: published-upgrade-survivor (published [email protected] updater driving the candidate package) and upgrade-survivor; package verification succeeded.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
Chat transcript tool-card disclosure toggles call the current render lifecycle's update hook (rebound on every projection without repainting cached rows) instead of the closure captured when the row was first rendered. Latent hardening; no visual change.

The session-roster-request-rate real-gateway e2e failure seen on this PR also fails on unrelated PRs today (e.g. openclaw#160170) and is not caused by this change.

Forward-port of release/2026.9.7 0c06877 and a124ea0.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 29, 2026
…nclaw#160170)

* fix(update): preserve retained rollback ownership (WIP)

Forward-port rollback-ownership and runtime-restoration corrections from 008d0c4. Preserve operator edits and changed branch refs, and record completed runtime restoration before rechecking authority. Validation remains incomplete under host load; do not publish.

* refactor(update): separate rollback steps and transaction fixtures

Keep retained Git rollback ownership and runtime restore replay fixes within existing file limits. Move rollback commands to the Git step owner and transaction regressions to sibling test support; preserve the original regression coverage. Completes the implementation extraction from 7d8c28f; validation and review are recorded in the PR.

* fix(update): preserve staged content during retained rollback

Replace retained reset --keep with a non-forcing detached checkout, conditional branch-ref update, and reattachment. The old reset discarded staged content in unchanged files when the working copy contained a different edit. A real-Git regression reproduced the index losing the staged bytes before this fix.

* fix(update): preserve branches claimed by linked worktrees

* fix(update): use Git's own branch custody check before rollback ref changes

Linked worktrees in a paused rebase or bisect detach HEAD, so worktree porcelain misses their branch reservation. Probe with a no-op branch reset, which Git refuses for every worktree owner state.

* fix(update): keep branch custody through retained rollback ref writes

Keep HEAD attached during retained source restoration and verify the reflog transition before restoring the runtime.

Restore claimed dev refs with create-only compensation after CAS deletion. Preserve operator edits and report explicit recovery steps.

* fix(update): keep the created dev branch on retained rollback

Leave the created dev ref intact during retained rollback and report a quoted manual cleanup hint while restoring the original checkout and runtime.

Remove post-delete custody scans and compensation, which cannot exclude in-flight claims or safely repair after authority revocation. Preserve the existing rewrite and non-retained cleanup paths.

* fix(update): keep newer branch writes out of rollback recovery guidance

Require an existing, readable branch reflog before retained rollback rewrites
source. If the ref changes after checkout, retain both runtimes and report the
expected, current, and reflog-previous commits without a forced-ref command.
Only offer conditional restoration of an overwritten earlier write while the
branch still points to the rollback commit.

Extend the real-Git transaction table with the post-checkout writer and
pre-mutation reflog refusal, and document the installed-updater behavior.
Both regressions fail against the previous implementation; the existing
pre-checkout writer recovery remains covered.

Validation: 101 candidate/runtime tests pass (176.9s wall); core and infra-test
typechecks, targeted oxlint, oxfmt, and git diff --check pass. The three focused
real-Git cases take 6.4s test time on one worker. Isolated P2 review is clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant