fix(cli): block package updates from inside running gateway service#75729
fix(cli): block package updates from inside running gateway service#75729
Conversation
|
Codex review: found issues before merge. Summary Reproducibility: yes. A source-level reproduction is a package-manager Next step before merge Security Review findings
Review detailsBest possible solution: Keep the runtime-state guard and marker cleanup, but block service-owned callers before stopping the Gateway or hand off to a detached updater outside the service control group. Do we have a high-confidence way to reproduce the issue? Yes. A source-level reproduction is a package-manager Is this the best way to solve the issue? No. The tri-state runtime inspection is useful, but allowing Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 81e1deade2b1. |
|
Fixes #75691 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ed22327046
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4bdb1a634a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Follow-up fixed in 6a4db93. I verified the concern was still present after the prior patch: The update guard now keeps the runtime result even when the service definition is missing:
Added regression coverage for the missing-definition-but-live-runtime case. Validation:
|
|
Thanks everyone for the review and follow-up testing. Plan from my side:
I am also running/asking for black-box coverage separately. Given the tradeoff, I do not think full systemd self-update acceptance should block this focused guard fix; if the black-box run finds another edge case, we can follow up with a small PR. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a4db93d6b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
459ca14 to
26b053b
Compare
26b053b to
8f301c5
Compare
|
Merged via squash.
Thanks @hxy91819! |
…penclaw#75729) Merged via squash. Prepared head SHA: 8f301c5 Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com> Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com> Reviewed-by: @hxy91819
…penclaw#75729) Merged via squash. Prepared head SHA: 8f301c5 Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com> Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com> Reviewed-by: @hxy91819
Summary
openclaw updatefrom inside a managed gateway service process could replace the active OpenClaw dist tree while the live gateway lazy-loads old chunks, leading to runtime errors or inconsistent state.isRunningInsideGatewayService).shouldBlockPackageUpdateFromGatewayServiceEnvto block package updates if the gateway is still running (with conservative fallback when service state cannot be inspected).PrePackageServiceStopto trackinspectedandrunningstate for accurate guard decisions.stripGatewayServiceMarkerEnvto prevent gateway service markers from leaking into the post-core update child process.Change Type
Scope
Linked Issue/PR
Root Cause
OPENCLAW_SERVICE_MARKER/OPENCLAW_SERVICE_KINDenv vars before allowing package replacement.Regression Test Plan
src/cli/update-cli.test.ts--no-restartmust be blocked; package update when gateway is not running must be allowed.User-visible / Behavior Changes
openclaw updatenow exits with an error and a helpful message when run from inside a running gateway service process (unless the service is stopped first or--no-restartis used with the service already stopped).Security Impact
No)No)No)No)No)Repro + Verification
Environment
Steps
openclaw gateway start).OPENCLAW_SERVICE_MARKER=openclaw OPENCLAW_SERVICE_KIND=gateway), runopenclaw update.Expected
Actual
Human Verification
update-cli.test.tstests pass.Compatibility / Migration
Yes)No)No)Risks and Mitigations