Skip to content

fix(update): verify every managed Gateway restart attempt - #155355

Merged
steipete merged 3 commits into
mainfrom
codex/service-restart-owner-main4311
Sep 23, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/service-restart-owner-main4311

Conversation

@steipete

@steipete steipete commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Updater restarts used a separate generated shell/PowerShell implementation, and some target-CLI restart attempts without a known version could skip final Gateway verification. Ordinary systemd metadata could also be mistaken for operator overrides and prevent an otherwise eligible rebind or recovery. Service regeneration could reorder retained PATH locations and fail the unchanged preservation audit.

User Impact

Every attempted managed Gateway restart uses the target installation's CLI and receives final verification. Confirmed empty override metadata remains eligible for the existing rebind/recovery flow; real overrides and unknown inspection results retain their safeguards. Native refusal, unhealthy startup, and readiness still pending remain distinct outcomes. Required service-runtime refresh failures still fail.

On Linux, regeneration preserves retained PATH precedence, including repeated and normalized spellings, while prepending newly added managed locations. Existing-only locations still pass the established safety filters. Code-update success can coexist with pending service reconciliation; a stopped service stays stopped until repaired.

Why This Change Was Made

Reuse the existing Gateway restart owner and remove the generated helper and its transient path plumbing. A shared service-command predicate distinguishes known-empty metadata from actual or unknown overrides in planning, observation, restoration, and legacy fingerprint normalization. Restoration uses the authored base so an omitted working directory stays omitted, while full restored-command equality remains required.

PATH merging now belongs to the existing daemon path-policy owner. It orders already-admitted entries around the retained definition, preserving the original safety filters, Darwin behavior, and service-preservation audit. No public options or storage contracts change. Related: #150153.

The qualified candidate removes 752 application lines and one tooling line from its base, plus 1,028 test/support lines. Documentation adds five lines explaining reconciliation outcomes and retained PATH ordering.

Evidence

The exact published head is e394dd53e70e464a1ef8de74da01be6e9b715922, tree 1797d4b7134c7f743b994258707fe148c4983903. It merges cleanly with the audited main snapshot without another source refresh.

The five-file PATH correction passes 354 tests across seven files, including planner/auditor coverage for duplicates, normalized paths, backslashes, and trailing separators. Its full selected changed gate passes types, lint, formatting, and the remaining guards. Fresh independent P0–P2 review has no actionable findings. The selected test command took 78.00 seconds; the changed gate took 712.94 seconds. These are validation timings, not a performance comparison.

The unchanged service-metadata repair retains its earlier 76-case owner proof. Exact-head CI run 35793684314 passed at e394dd53e70e464a1ef8de74da01be6e9b715922, including its required CI gate. Preflight verified merge 072d8410a with that candidate as its second parent. The exact-head package and corrected native install-rebind acceptance now pass. One 95,719,594-byte candidate package has SHA-256 710033f736cb12b24aed46f119265dd38fc2f2233b01bfc0dcb71669fe6e6790.

Exact-candidate native acceptance

The real installed e394dd53 candidate updated itself between two stable installation prefixes using that same package. The live update executor reached the target CLI's native gateway install --force reconciliation path, moving the managed service from the original prefix to the driver prefix. The native service and authenticated Gateway observations agreed on the PID change from 21304 to 28887. The refreshed service was already healthy, so the existing owner correctly skipped a redundant explicit restart.

Update history records succeeded; service readiness, exact candidate identity, both session messages and metadata, and agent schema 23 were preserved. Derived history-envelope observation fields were allowed to refresh. Independent verification rehashed all 405 archive members and 147 compact evidence files, and verified lease cleanup. A separate verification rehashed the package and acceptance receipts and inspected the native command and PID observations.

This cell proves candidate-to-same-candidate native rebind. It is separate from the genuine published-driver cell below. Independent rebind receipt SHA-256: 10d4752ccf239b946a91286b5368a8dd43f5c90c25775f646aab3308569a9069.

Published 2026.9.2 upgrade and recovery coverage

The genuine published [email protected] driver at commit 3928bad9badfcb6c7d140530435e806fb8092190 successfully installed the same frozen e394dd53 package. Native and authenticated observations verified the Gateway PID changing from 29068 to 30733 and serving the exact candidate. Agent schema upgraded from 19 to 23; session metadata and both messages were preserved exactly. Durable update history records success, candidate Doctor exited successfully, and the native post-core path executed once.

Independent verification rehashed all 339 archive members and 125 compact files. The published driver's missing optional continuation-row identity remains a diagnostic; it is not relabeled as a successful continuation check. SSH exit-255 cleanup warnings are retained, while terminal inspection confirms the lease, host, and provisioning resource are gone. Published-driver receipt SHA-256: a6ac96d574c664a9fdb4a6dcf2d6699e53ae331b0ed6ffea874da944fd94fe29.

Recovery coverage comes from the retained 67 original-service and nine root-plan cases, whose owner/test postimages remain unchanged. They exercise the real update/recovery orchestration with simulated native manager, HTTP, and package transport, covering readiness/health failure, missing packages, authority revocation, replaced definitions, and restored fingerprints. Together with the repaired PATH suites and the two live cells, these supply the selected proof. No native failed-activation recovery result is claimed.

Retained source-bound proof and original failures
  • Focused Linux Testbox proof passed 146 service integration cases and 13 selected updater cases, plus scoped formatting and lint. Commands took 148.85 and 26.77 seconds. The original application postimages retain their binding to the qualified 74b22ee3 cut: 38 changed-check components, nine restart-log cases, a canonical package build, and two real Linux source-owner → built-CLI → systemd restart cells. Those cells replaced the PID and verified health/readiness, with and without required service refresh. They are not new runs of the final candidate, a complete published-driver upgrade, or macOS/Windows whole-CLI proof.
  • The service-metadata repair had two causal failures on original 2dd1ef59 production source. Both complete owner suites then passed 76 cases: 67 original-service cases measured 199.70 seconds and nine root-plan cases 0.044 seconds. Review was clean. The rebased correction preserves that patch; the PATH follow-up does not change its admission or recovery/reporting behavior.
  • A genuine earlier package was built from private witness 8e33aa9728ca24978e160fcd8830a57b1d2d2bdd, tree 3a2db9e3ef3ef77e8bbc663290c2134071b2018b. That evidence belongs to its original source tree and does not qualify the new published head.
  • The earlier d6088404 native acceptance failure, the global-install-foreign-destination result, and original fixture/setup failures remain preserved. The PATH correction leaves the preservation audit intact. The passing exact-e394dd53 stable-prefix cell above is a separate result and does not rewrite those failures.
  • An earlier PATH changed-gate run exited 143 during the max-lines check without a diagnostic. The exact unchanged guard subsequently passed in 59.10 seconds, followed by the complete successful 712.94-second gate. No baseline, timeout, or environment change was used to relabel the interrupted run.

The exact-head source, CI, package, and native rebind proofs are complete. The genuine published-driver proof and the explicitly bounded recovery coverage are also qualified. Native preparation, required CI, and merge admission passed; this exact candidate landed as b855e24dac7d67ad0cf7b902ddecf42f97ef197c. The actual merge-parent delta matches the qualified patch, all application postimages are byte-identical, and the native receipt and ownership-scoped cleanup are complete. No production deployment or release is claimed.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime cli CLI command changes scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Sep 22, 2026
@clawsweeper

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

@steipete
steipete marked this pull request as ready for review September 22, 2026 02:07
@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 22, 2026
@clawsweeper

clawsweeper Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 10:08 PM ET / September 23, 2026, 02:08 UTC (Revision 8).

ClawSweeper review

What this changes

Routes updater restarts through the installed Gateway CLI, verifies every attempt, recognizes empty service override metadata, and preserves retained PATH ordering during service regeneration.

Merge readiness

✅ Ready for maintainer review

This remains useful work: current main and the latest release retain the verification gap. The updated published-driver evidence resolves the previous upgrade concern; source review and retained recovery coverage reveal no actionable blocker.

Priority: P2
Reviewed head: e394dd53e70e464a1ef8de74da01be6e9b715922

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with relevant native upgrade observations, retained recovery coverage, and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied observations connect the exact candidate's update executor and native install path to successful Linux service rebind and published-2026.9.2 upgrade, including PID replacement, authenticated identity, readiness, and preserved sessions. Earlier source-bound restart observations and retained owner tests supplement this evidence; simulated failed-activation recovery is not represented as native proof. No stored-data format or schema change is introduced.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied observations connect the exact candidate's update executor and native install path to successful Linux service rebind and published-2026.9.2 upgrade, including PID replacement, authenticated identity, readiness, and preserved sessions. Earlier source-bound restart observations and retained owner tests supplement this evidence; simulated failed-activation recovery is not represented as native proof. No stored-data format or schema change is introduced.
Evidence reviewed 10 items Pinned change ownership: Reviewed the introduced delta from 05804bc to e394dd5. Raw test-merge metadata confirms the supplied base followed by the exact PR head; unrelated endpoint drift was excluded.
Current-main necessity: Current main still selects the generated restart helper and conditions verification of CLI restarts on additional version, mode, or preservation flags. The candidate instead verifies whenever a restart was attempted.
Latest-release comparison: The v2026.9.5 source also retains the generated helper and conditional verification, so the central repair is not already shipped in the supplied latest release.
Findings None None.
Security None None.

How this fits together

The updater reconciles an installed Gateway with its operating-system service after replacing application code. Service ownership checks control regeneration and restart, followed by health verification and recovery reporting.

flowchart TD
  A[Installed updater] --> B[Service ownership inspection]
  B --> C[Preserve or regenerate definition]
  C --> D[Target Gateway CLI]
  D --> E[Native service manager]
  E --> F[Health and readiness verification]
  F --> G[Update result or guarded recovery]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -752, Tests -1028, Docs +5, Config 0, Other -1. Total -1776 across 34 files.

View PR surface stats
Area Files Added Removed Net
Source 11 169 921 -752
Tests 19 856 1884 -1028
Docs 1 5 0 +5
Config 1 1 1 0
Generated 0 0 0 0
Other 2 1 2 -1
Total 34 1032 2808 -1776

Review metrics

None.

Technical review

Best possible solution:

Keep one native restart owner with unconditional post-attempt verification and preserve operator settings through the existing service audit and guarded recovery paths.

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

Yes, from source: current main can attempt an unknown-version package restart without final verification, and empty systemd override objects prevent eligible rebinds. This read-only review did not execute a reproduction.

Is this the best way to solve the issue?

Yes. Reusing the existing native CLI removes competing restart logic, while the metadata and PATH repairs retain ownership checks and the unchanged preservation audit.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The supplied observations connect the exact candidate's update executor and native install path to successful Linux service rebind and published-2026.9.2 upgrade, including PID replacement, authenticated identity, readiness, and preserved sessions. Earlier source-bound restart observations and retained owner tests supplement this evidence; simulated failed-activation recovery is not represented as native proof. No stored-data format or schema change is introduced.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦐 gold shrimp.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: Repairs bounded managed-service update and verification failures without evidence of an ongoing widespread outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied observations connect the exact candidate's update executor and native install path to successful Linux service rebind and published-2026.9.2 upgrade, including PID replacement, authenticated identity, readiness, and preserved sessions. Earlier source-bound restart observations and retained owner tests supplement this evidence; simulated failed-activation recovery is not represented as native proof. No stored-data format or schema change is introduced.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied observations connect the exact candidate's update executor and native install path to successful Linux service rebind and published-2026.9.2 upgrade, including PID replacement, authenticated identity, readiness, and preserved sessions. Earlier source-bound restart observations and retained owner tests supplement this evidence; simulated failed-activation recovery is not represented as native proof. No stored-data format or schema change is introduced.

Evidence

What I checked:

  • Pinned change ownership: Reviewed the introduced delta from 05804bc to e394dd5. Raw test-merge metadata confirms the supplied base followed by the exact PR head; unrelated endpoint drift was excluded. (072d8410a817)
  • Current-main necessity: Current main still selects the generated restart helper and conditions verification of CLI restarts on additional version, mode, or preservation flags. The candidate instead verifies whenever a restart was attempted. (src/cli/update-cli/update-command-service.ts:591, 1dd82fa0d398)
  • Latest-release comparison: The v2026.9.5 source also retains the generated helper and conditional verification, so the central repair is not already shipped in the supplied latest release. (src/cli/update-cli/update-command-service.ts:583, ec9c1a13db89)
  • Recovery safeguards remain enforced: Restoration retains live executor and native-operation checks, exact rebind and runtime-pin matching, current schema admission, a before-mutation revalidation callback, and full restored-command equality. The change selects the authored definition only after those checks. (src/cli/update-cli/update-command-original-service-restore.ts:58, e394dd53e70e)
  • Recovery coverage and review continuity: The retained compensation cases exercise known-empty systemd metadata, authored working-directory restoration, foreign runtime pins, unrelated replacement, revoked authority, and incompatible schemas. Recovery owner/test files are unchanged from d608840. This supports the bounded recovery assessment without claiming a native failed-activation experiment or carrying forward the previous proof request automatically. (src/cli/update-cli/update-command-original-service-current.test-support.ts:212, e394dd53e70e)
  • PATH preservation and safety: The moved PATH owner retains existing admission filters and Darwin behavior, then orders admitted entries around the retained definition. Installer-to-audit tests cover repeated entries, equivalent spellings, POSIX backslashes, trailing separators, and unsafe existing-only paths; the preservation audit itself is unchanged. (src/daemon/service-path-policy.ts:118, e394dd53e70e)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Jason (Json): Raw commit 97c7b35 adds src/cli/update-cli/update-command-original-service-restore.ts:24 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 97c7b3593392; files: src/cli/update-cli/update-command-original-service-restore.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 (7 earlier review cycles)
  • reviewed 2026-09-22T02:11:51.615Z sha 2dd1ef5 :: blocked before merge. :: none
  • reviewed 2026-09-22T14:06:21.298Z sha f0e4ce6 :: blocked before merge. :: none
  • reviewed 2026-09-22T16:35:23.170Z sha f0e4ce6 :: blocked before merge. :: none
  • reviewed 2026-09-22T19:28:12.095Z sha f0e4ce6 :: blocked before merge. :: none
  • reviewed 2026-09-22T22:55:11.415Z sha e394dd5 :: blocked before merge. :: none
  • reviewed 2026-09-22T23:07:29.720Z sha e394dd5 :: blocked before merge. :: none
  • reviewed 2026-09-23T01:08:52.496Z sha e394dd5 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 22, 2026
Remove the generated shell and PowerShell restart helpers in favor of the
target installation's Gateway CLI. Verify attempted restarts even when the
target version is unknown, while retaining structured native refusal,
readiness-pending, and unhealthy-start outcomes.

Related: #150153
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 22, 2026
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph guard cleared

This PR no longer has dependency changes awaiting review. A future dependency graph change from an external contributor requires a maintainer's /allow-dependencies-change comment after the guard notice identifies that revision.

  • Current SHA: e394dd53e70e464a1ef8de74da01be6e9b715922

@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 22, 2026
Keep the existing safety admission and preservation audit unchanged, then reorder admitted PATH locations around the retained definition. Move PATH policy to its existing daemon owner and exercise normalization, repeated entries, and installer regeneration through planner/audit tests. Code success with reconciliation pending remains intentional.
@steipete
steipete force-pushed the codex/service-restart-owner-main4311 branch from f0e4ce6 to e394dd5 Compare September 22, 2026 22:41
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations labels Sep 22, 2026
@github-actions github-actions Bot removed the dependencies-changed PR changes dependency-related files label Sep 23, 2026
@steipete
steipete merged commit b855e24 into main Sep 23, 2026
254 checks passed
@steipete
steipete deleted the codex/service-restart-owner-main4311 branch September 23, 2026 02:32
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
…55355)

* fix(update): verify every managed Gateway restart attempt

Remove the generated shell and PowerShell restart helpers in favor of the
target installation's Gateway CLI. Verify attempted restarts even when the
target version is unknown, while retaining structured native refusal,
readiness-pending, and unhealthy-start outcomes.

Related: openclaw#150153

* fix(update): recognize empty managed service overrides

* fix(daemon): preserve retained PATH precedence during regeneration

Keep the existing safety admission and preservation audit unchanged, then reorder admitted PATH locations around the retained definition. Move PATH policy to its existing daemon owner and exercise normalization, repeated entries, and installer regeneration through planner/audit tests. Code success with reconciliation pending remains intentional.
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR 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. scripts Repository scripts 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