Skip to content

fix: keep update restarts under the native Gateway owner - #153643

Closed
steipete wants to merge 6 commits into
mainfrom
codex/update-restart-native-owner
Closed

steipete wants to merge 6 commits into
mainfrom
codex/update-restart-native-owner

Conversation

@steipete

@steipete steipete commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes update restarts taking a separate detached helper path when the managed Gateway service needs its environment refreshed.

User Impact

Updates use the fenced native restart owner, preserving the service definition, readiness verification, and rollback identity. No configuration or migration is required.

Why This Change Was Made

Delete the standalone shell/Windows restart generator and use the existing update-owned Gateway command. Preserve current install-root reconciliation, original-port restoration, and unverified-recovery handling. This removes 798 production lines and obsolete helper-only tests.

Related: #150153 (split replacement; the original PR is not intended to merge).

Evidence

  • The causal regression covers successful native restart and refusal after ownership revocation. The production edit is unchanged through the main integrations.
  • Local checks: full changed-code gates on the initial main refresh; after resolving the incoming native-owner fixture conflicts, 72 focused lifecycle/updater cases, CLI/service types, lint, formatting, and independent P2 review pass. The transferred outcome tests preserve main's real serving-owner leases and assertions.
  • Test-harness repairs are upstream in fix(test): drain shared-state workers before harness cleanup #153663 and fix: close agent database readers between test files #153749. The earlier selection controls and original six-case sequence pass; the complete selection file passes 161/161. Outcome checks pass 19/19 on each of Node 24 and Node 26. The retained-reader repair has real same-worker red/green proof and green exact-head CI. Its canonical merge is integrated here without changing the helper patch; the original CI shard's exact contaminating producer remains unproved. Fresh helper-head CI remains required.
  • Linux package proof passed on exact helper commit 3007d28: published 2026.9.5 upgraded to that candidate with automatic migration and state preservation. A separate candidate-driven restart used real Gateway processes with the maintained systemd transport fixture, mock inference, and a labeled synthetic future-version cohort. All 68 artifacts were hash-verified and the lease released. This is not native systemd or published-driver automatic-restart proof.
  • The incoming POSIX restart-intent owner matches the independently qualified source in fix(gateway): refuse recovered restarts without a verified service command #153510. That native campaign is separate from this helper head.
  • Before landing: green exact-head CI and native Windows fresh-install/published-upgrade/replacement-path qualification. Windows work is bound to the frozen corrected-stack driver f1888b1; its attribution stays separate from this standalone branch.

Route update restarts through the target CLI executor and remove the detached platform helper. Preserve service definitions, original update authority, child settlement, and final readiness checks, including targets without a known version.
@clawsweeper

clawsweeper Bot commented Sep 20, 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 gateway Gateway runtime cli CLI command changes scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Sep 20, 2026
@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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 20, 2026, 10:46 AM ET / 14:46 UTC (Revision 5).

ClawSweeper review

What this changes

Routes update-triggered Gateway restarts through the existing native service command, removes detached restart scripts, and transfers regression coverage to the replacement path.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: the cutover remains useful and is not implemented on fetched main. No actionable patch defect was found; the previously identified Windows qualification requirement remains unresolved.

Priority: P2
Reviewed head: 5a61a542c98e550ca3a2dfcc926a7e383cefdce6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level simplification with useful regression coverage and no actionable code findings; platform qualification remains outstanding.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate does not apply to this maintainer-authored PR. The captured body reports Linux candidate restart and published-upgrade evidence with explicit limits; native Windows qualification remains a separate landing requirement.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate does not apply to this maintainer-authored PR. The captured body reports Linux candidate restart and published-upgrade evidence with explicit limits; native Windows qualification remains a separate landing requirement.
Evidence reviewed 7 items Introduced restart cutover: The pinned base-to-head diff removes the detached helper branch. The remaining command uses the existing native restart owner, and every attempted restart now reaches readiness verification.
Current-main necessity and release boundary: Fetched main still contains the restartScriptPath/runRestartScript branch. The supplied latest release, v2026.9.5, also contains the standalone helper; the central cutover is not already delivered by either inspected revision.
Established ownership contract: The current CLI documentation requires native update commands to retain the original live owner and explicitly refuses detached or Windows Startup-folder fallbacks that cannot retain that ownership. The replacement command binds its target installation, preserves the service definition, and joins child processes.
Findings None None.
Security None None.

How this fits together

The updater replaces OpenClaw’s installed code and asks the platform service manager to restart the Gateway. Restart ownership and health verification determine whether the update can finish successfully or must retain recovery material.

flowchart TD
 A[Installed updater] --> B[Candidate installation]
 B --> C[Live update ownership check]
 C -->|Authorized| D[Native Gateway restart command]
 C -->|Revoked| E[Refuse service mutation]
 D --> F[Platform service manager]
 F --> G[Gateway readiness verification]
 G --> H[Finish update or retain recovery]
Loading

Before merge

  • Resolve merge risk (P1) - Windows installations now use the native Scheduled Task and Startup-entry lifecycle instead of the deleted helper; an existing installation could remain stopped if its replacement path cannot activate successfully. Native fresh-install, published-upgrade, and replacement-path qualification remains pending, and separate corrected-stack results need an explicit source relationship to this branch.
  • Complete next step (P2) - Complete the native Windows fresh-install, published-upgrade, and replacement-path qualification already required by the PR body, and establish how any separate corrected-stack evidence applies to this branch.
Agent review details

Security

None.

PR surface

Source -798, Tests -1181, Config 0, Other 0. Total -1979 across 21 files.

View PR surface stats
Area Files Added Removed Net
Source 5 3 801 -798
Tests 14 511 1692 -1181
Docs 0 0 0 0
Config 1 1 1 0
Generated 0 0 0 0
Other 1 1 1 0
Total 21 516 2495 -1979

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Complete Windows qualification (recommended)
    Retain the stated landing gate until native fresh-install, published-upgrade, and replacement-path results establish applicability to this branch.

Technical review

Best possible solution:

Keep one fenced native restart owner, with Windows upgrade evidence demonstrating preserved service identity, successful readiness, and safe recovery through the replacement path.

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

Yes, at source level: a writable service refresh can select the standalone helper on fetched main, bypassing the documented native command ownership path. No runtime reproduction was executed in this read-only review.

Is this the best way to solve the issue?

Yes: reusing the existing fenced command removes competing restart ownership while retaining readiness and recovery handling; native Windows qualification is still needed to establish upgrade safety.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 41bc123fcb29.

Labels

Label justifications:

  • P2: This is a focused updater lifecycle repair without evidence of a current emergency regression.
  • merge-risk: 🚨 compatibility: Removing the platform helper changes how existing Windows services restart, while native upgrade qualification remains explicitly pending.
  • 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 ordinary external-contributor proof gate does not apply to this maintainer-authored PR. The captured body reports Linux candidate restart and published-upgrade evidence with explicit limits; native Windows qualification remains a separate landing requirement.

Evidence

What I checked:

  • Introduced restart cutover: The pinned base-to-head diff removes the detached helper branch. The remaining command uses the existing native restart owner, and every attempted restart now reaches readiness verification. (src/cli/update-cli/update-command-service.ts:553, 5a61a542c98e)
  • Current-main necessity and release boundary: Fetched main still contains the restartScriptPath/runRestartScript branch. The supplied latest release, v2026.9.5, also contains the standalone helper; the central cutover is not already delivered by either inspected revision. (src/cli/update-cli/update-command-service.ts:558, 41bc123fcb29)
  • Established ownership contract: The current CLI documentation requires native update commands to retain the original live owner and explicitly refuses detached or Windows Startup-folder fallbacks that cannot retain that ownership. The replacement command binds its target installation, preserves the service definition, and joins child processes. Public docs: docs/cli/update.md. (docs/cli/update.md:166, 5a61a542c98e)
  • Allowed and revoked-owner regression coverage: The added regression prepares a writable unknown-version target, invokes the registered native restart command, and checks that revocation before restart prevents the service mutation and verification callback. Transferred outcome cases retain refusal, slow startup, malformed response, and unsettled-child checks. These were inspected, not executed. (src/cli/update-cli/update-command-restart-outcome.test-support.ts:46, 5a61a542c98e)
  • Captured proof and remaining qualification: The supplied body at sourceRevision ac8a15edc2adb52d3558e787e3471a99ad629f96ea205ae6a2d4f3bc9313b1b9 reports published-2026.9.5 Linux migration/state preservation and a separate candidate-driven restart at 3007d28. It expressly excludes native systemd and published-driver automatic-restart proof, and retains native Windows fresh-install/published-upgrade/replacement-path qualification before landing. The linked workflow currently reports cancelled with no listed artifacts, so its workflow status independently proves neither the claimed scenario success nor failure. (3007d28ac468)
  • Re-review continuity: The prior completed review had no findings and requested Windows qualification. Tree entries confirm identical service, restart-context, and restart-log blobs between the prior reviewed head and this head. The finalization file changed; its introduced delta was reviewed against the pinned base. A broader historical comparison and blame could not complete because required historical blobs were unavailable; no introduction attribution is claimed. (src/cli/update-cli/update-command-service.ts:553, 5a61a542c98e)

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.

  • Attach redacted native Windows fresh-install, published-version upgrade, and replacement-path evidence showing preserved service identity and successful readiness, with applicability to this branch established.

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 (4 earlier review cycles)
  • reviewed 2026-09-20T10:56:12.836Z sha 3007d28 :: blocked before merge. :: none
  • reviewed 2026-09-20T11:10:36.901Z sha 3007d28 :: blocked before merge. :: none
  • reviewed 2026-09-20T11:52:57.563Z sha 3007d28 :: blocked before merge. :: none
  • reviewed 2026-09-20T13:22:44.850Z sha 2b3e9ca :: blocked before merge. :: none

@steipete
steipete marked this pull request as ready for review September 20, 2026 11:03
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 20, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #155355 (commit b855e24dac7d67ad0cf7b902ddecf42f97ef197c), which is already on main.

I checked the original intent against current source and had the closure independently challenged. The update now invokes the target installation’s fenced Gateway CLI, preserves its service definition, and verifies every attempted restart, including unknown-version targets. Install-root reconciliation, original command/environment restoration, and refusal of unverified recovery remain in the owning path. The exact detached helper and its helper-only tests are removed. The original 377-line restart-outcome suite remains registered and differs only in its UpdateRunResult type-import path; its allowed/revoked-owner, readiness, refusal, and malformed-result cases are preserved. Adjacent standalone execution/finalization cleanup is covered by #154160.

This establishes source-level supersession of this branch. No new native Windows qualification is claimed; the broader update/platform work remains tracked separately in #150153.

@steipete steipete closed this Sep 24, 2026
@RomneyDa
RomneyDa deleted the codex/update-restart-native-owner branch October 22, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes 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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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