Skip to content

feat: restart the managed gateway with one command - #90

Merged
paulcam206 merged 1 commit into
mainfrom
gateway-service-restart
Sep 21, 2026
Merged

paulcam206 merged 1 commit into
mainfrom
gateway-service-restart

Conversation

@paulcam206

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Restarting the managed OpenClaw gateway currently requires separate stop and start commands, leaving a window for another lifecycle operation to interleave.

User Impact

User impact: Operators can run clawctl gateway-service restart to replace the gateway in one lifecycle operation; if the existing gateway cannot be confirmed stopped, the command aborts without starting a second process.

Why This Change Was Made

The new command composes the existing stop and start behavior under one lifecycle lock, waits for the replacement listener like start, preserves the recorded autostart choice, and treats a missing or already-exited gateway as a successful no-op stop. It also adds matching human/JSON output, help, documentation, and NativeAOT coverage.

Evidence

Validated at head 2bada1f093bb04c55fb0cf5e746206f0db45a1ca after rebasing onto origin/main:

  • .\scripts\Test-DotNetQuality.ps1 — passed with 0 warnings and 0 errors.
  • dotnet test .\OpenClaw.Gateway.MSIX.slnx --configuration Release --no-restore — passed, 847 tests.
  • .\scripts\Test-NativeAotCli.Tests.ps1 — passed, 19 NativeAOT scenarios.
  • .\scripts\Test-DocReferences.ps1 — passed with 0 findings.
  • git diff --check origin/main...HEAD — passed.

Not run: MSIX composition/signing and installed-package deployment. This change does not modify packaging or signing inputs, and deployment would mutate installed package/session state; the controller, CLI, output, and NativeAOT paths are covered by isolated tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e692c2df-7e14-4551-8cbd-b8df6ad15018
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

🦞👀
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 P2 Normal priority bug or improvement with limited blast radius. 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 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 6:39 PM ET / 22:39 UTC.

ClawSweeper review

What this changes

Adds clawctl gateway-service restart to stop and replace the managed gateway under one lifecycle lock, with matching output, documentation, and tests.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main and the latest release lack the atomic restart command. No blocking correctness or security defect was found in the introduced changes.

Priority: P2
Reviewed head: 2bada1f093bb04c55fb0cf5e746206f0db45a1ca

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful lifecycle coverage, reported required validation, and no identified blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The collaborator-authored PR is exempt from the external proof gate. Reported native execution covers command help; isolated controller tests cover restart sequencing and refusal paths, without claiming an installed gateway restart was observed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The collaborator-authored PR is exempt from the external proof gate. Reported native execution covers command help; isolated controller tests cover restart sequencing and refusal paths, without claiming an installed gateway restart was observed.
Evidence reviewed 8 items Introduced lifecycle operation: The pinned base-to-head diff introduces RestartAsync, which holds the lifecycle lock across the existing stop and start operations and returns without launching when stopping fails.
Current main still lacks restart: The current-main command tree registers gateway-service start, status, and stop, but no restart command.
Latest release check: The command tree at the supplied v2026.9.4-msix.3 release revision likewise registers only start, status, and stop. Its source was inspected through GitHub after the local historical blob was unavailable.
Findings None None.
Security None None.

How this fits together

The Windows launcher manages a background OpenClaw gateway inside its recorded isolated session. The restart command coordinates existing process inspection, termination, and startup operations, then reports the replacement listener or failure.

flowchart TD
    A[Operator restart command] --> B[Gateway lifecycle lock]
    B --> C[Inspect and stop recorded gateway]
    C --> D{Stop confirmed or no process?}
    D -->|No| E[Retain record and report failure]
    D -->|Yes| F[Start gateway in recorded session]
    F --> G[Observe listener and report result]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test growth production +105 net lines; tests +233 net lines Production growth implements the new command and shared lifecycle composition; most added lines exercise its behavior.

Technical review

Best possible solution:

Keep restart as a composition of the existing gateway lifecycle owner, preserving process verification, the shared lock, and observed-listener reporting.

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

Not applicable: this adds a command rather than repairing a demonstrated failure. Source inspection confirms that main lacks the requested atomic operation.

Is this the best way to solve the issue?

Yes: composing the existing stop and start operations inside their owner is a narrow solution that avoids a second lifecycle implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 288521d5fcc9.

Labels

Label changes:

  • add P2: This is a bounded gateway operations improvement without evidence of an urgent existing outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The collaborator-authored PR is exempt from the external proof gate. Reported native execution covers command help; isolated controller tests cover restart sequencing and refusal paths, without claiming an installed gateway restart was observed.

Label justifications:

  • P2: This is a bounded gateway operations improvement without evidence of an urgent existing outage.
  • 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 collaborator-authored PR is exempt from the external proof gate. Reported native execution covers command help; isolated controller tests cover restart sequencing and refusal paths, without claiming an installed gateway restart was observed.

Evidence

What I checked:

Likely related people:

  • paulcam206: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@paulcam206
paulcam206 marked this pull request as ready for review September 21, 2026 23:08
@paulcam206
paulcam206 merged commit 2947647 into main Sep 21, 2026
19 checks passed
@paulcam206
paulcam206 deleted the gateway-service-restart branch September 21, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant