Repository navigation
fix(status): resolve installed service state from the service's own environment - #187901
Conversation
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis PR reconstructs installed Gateway state from the service’s environment instead of inheriting the inspecting CLI’s state selectors. Example: A 2026.10.9 CLI repairs isolated state while an unrelated 2026.7.1-2 LaunchAgent records only HOME.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 2 items remain Keep open for maintainer handling: the central Doctor bug is fixed on main, but this PR has a reported merge conflict and an introduced profile-selection defect that can bypass the older-service migration guard. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherCLI startup and diagnostics project installed service metadata into config and database identities consumed by Doctor, status, update admission, and the existing migration guard. flowchart TD
A[CLI environment] --> C[Service environment projection]
B[Installed service command] --> C
C --> D[Config and database identity]
D --> E[Migration guard]
E --> F[Doctor migration or refusal]
D --> G[Status and update diagnostics]
Technical reviewBest possible solution: Preserve main’s merged installation-identity repair and its argument-profile protection, carrying forward only the distinct shared diagnostic improvements. Do we have a high-confidence way to reproduce the issue? The pinned source establishes both the original selector-inheritance failure and the introduced argument-profile omission; current main fixes the original report, and no target code was executed during this review. Is this the best way to solve the issue? Correcting the existing environment owner is appropriate, but its consumers need the service’s effective command-line profile as well as its saved environment. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c77b791cf4fc; fix evidence: commit c77b791cf4fc, main fix timestamp 2026-10-29T21:20:53Z. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +15, Tests +68, Docs +5. Total +88 across 11 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 29, 2026, 5:32 PM ET / 21:32 UTC. |
Follow up on #187886 by applying its four-selector clearing approach in mergeGatewayServiceEnv and reusing that helper for status config, runtime intent, log guidance, and Doctor updater scans. Keep the landed identity producer and migration regressions unchanged. Related: #187886, #187878. Thanks @shakkernerd for the original report and identity-producer fix.
1cb82bb to
8f89cb2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f89cb288d
ℹ️ 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".
| OPENCLAW_HOME: undefined, | ||
| OPENCLAW_STATE_DIR: undefined, | ||
| OPENCLAW_PROFILE: undefined, | ||
| OPENCLAW_CONFIG_PATH: undefined, |
There was a problem hiding this comment.
Restore command-line profiles in the POSIX service projection
On Linux/macOS, an installed service can select its profile through openclaw.mjs --profile work gateway without declaring OPENCLAW_PROFILE in its environment. Clearing the caller's selectors now makes an inspecting openclaw --profile work gateway status resolve that service's config to ~/.openclaw/openclaw.json instead of ~/.openclaw-work/openclaw.json, because the subsequent argv-profile projection only runs on Windows. resolveGatewayLifecycleContext also consumes this helper, so restart health checks can use the wrong configuration and port. Project the installed command's POSIX profile after clearing the caller selectors, as inspectCliGatewayServiceInstallation already does in src/cli/run-main-service-installation.ts.
Useful? React with 👍 / 👎.
Restore the scheduled-task stop fixture’s exact installed-service environment assertion while preserving its process identity and termination controls. Refs #187901.
…nvironment (openclaw#187901) openclaw#187886 stopped the installed-service identity producer from inheriting the caller's state selectors. Gateway status gathering, projection and printing, Doctor platform notes, and the service environment merge still merged the CLI's OPENCLAW_HOME / OPENCLAW_STATE_DIR / OPENCLAW_PROFILE / OPENCLAW_CONFIG_PATH into an unrelated installed service's identity, so they could report an isolated CLI's state as belonging to that service. They now use the same selector-clearing approach and existing merge helper; a positively identified own service keeps its live environment. Follow-up to openclaw#187886 for openclaw#187878. Thanks @shakkernerd.
…law#187967) Restore the scheduled-task stop fixture’s exact installed-service environment assertion while preserving its process identity and termination controls. Refs openclaw#187901.
Restore the scheduled-task stop fixture’s exact installed-service environment assertion while preserving its process identity and termination controls. Refs #187901. (cherry picked from commit 0078d6a) Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Follow-up to #187886; related to #187878. Installed-service diagnostics still inherited missing state selectors from the inspecting CLI after the core Doctor migration fix landed.
User Impact
Gateway status reads the installed service's config and runtime intent, prints its journal/log guidance, and lets Doctor scan its updater context without borrowing an isolated CLI's state selectors.
Why This Change Was Made
Reuse
mergeGatewayServiceEnvfor the remaining direct environment merges. The shared helper now follows #187886's approach: clear the caller's four OpenClaw home/state/profile/config selectors, then overlay the installed service environment. Existing HOME fallback, Windows command-line profile handling, and native supervisor selection stay with their existing owners.The identity producer in
run-main-service-installation.tsand both of #187886's regression files are unchanged from main. The original migration fix and tests have been removed from this PR. Thanks @shakkernerd for the report and the landed identity-producer fix.Evidence
New sibling regressions fail against current main at
c77b791cf4fca27afe64a6da4ee9ba22f5133a28: 7 failures across 5 files, each at the intended selector leak.After the sibling-only fix:
gateway status --runtime-intent-onlywith private temporary HOME/state/config and a synthetic unloaded LaunchAgent. Result: exit 0, service runtime intent known. A deliberately unsupported isolated caller runtime-pin store remained at schema 99, proving it was not used as the installed service's store. No service was started or restarted. The live invocation took 5.438 s of test time; shared compiler preparation took 25.4 s. The first standalone cached-fixture attempt failed on a cleaned-up absolute module path; proof was completed under the active supported CLI harness.git diff --check, and Madge pass (0 cycles).c77b791cf4fc: scoped-clean at P0–P2. Simplification keeps the existing shared helper as the sole sibling projection owner. Production +26/−20 (net +6 LOC); tests +90/−3 (net +87); docs +5.check:changedremains omitted under the campaign's local gate budget. PR CI is the broad proof; no merge requested.