feat: restart the managed gateway with one command - #90
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e692c2df-7e14-4551-8cbd-b8df6ad15018
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 6:39 PM ET / 22:39 UTC. ClawSweeper reviewWhat this changesAdds 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
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 restartto 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
2bada1f093bb04c55fb0cf5e746206f0db45a1caafter rebasing ontoorigin/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.