Repository navigation
fix(update): report unavailable systemd inspection without a false recovery failure - #175928
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce94653a94
ℹ️ 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".
| !error.failureFacts.some( | ||
| (fact) => | ||
| fact.check === "managed-service-runtime" || fact.code === "service-ownership-unverified", |
There was a problem hiding this comment.
Accept reason-coded systemd inspection failures
When systemd reports a real inspection failure such as systemd-user-bus-unavailable or systemd-inspection-deadline-exceeded, the runtime preserves that value as inspectionReason, and assertGatewayServiceAdmissionUnchanged produces a failure fact with check: "managed-service" and that reason as its code. This predicate accepts only managed-service-runtime or the generic service-ownership-unverified, so the new process-owner fallback is skipped for the concrete Linux failures it is intended to tolerate; only the reasonless test fixture reaches it. Accept reason-coded unavailable-inspection facts while continuing to exclude actual ownership-change refusals.
AGENTS.md reference: AGENTS.md:L82-L86
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR retains native systemd failure details and avoids false recovery failures after an untouched update refusal. Example: An update from 2026.10.3 is refused before stopping or changing the Gateway.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Needs changes before merge - 4 items remain This PR addresses a real reporting defect and preserves existing ownership checks, but four diagnostic defects need correction before merge. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe update CLI consumes native service inspections, checks admission, and records failure and recovery outcomes in update history. flowchart TD
A[Update CLI] --> B[Service admission]
B --> C[Native systemd probes]
C --> D[Inspection diagnostics]
D --> E[Failure facts]
B --> F[Recovery observation]
E --> G[Update report]
F --> G
Technical reviewBest possible solution: Keep the existing inspection and recovery owners, correcting command classification and context-specific guidance without adding fallback authority. Do we have a high-confidence way to reproduce the issue? Source shows both the false recovery-verification path and the introduced diagnostic defects; no target code was executed during this review. Is this the best way to solve the issue? The narrowed approach uses existing owners and addresses the reporting invariant, but command identity and refusal-specific guidance need the corrections listed below. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 4247e12bb83e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +39, Tests +99. Total +138 across 21 files. Added test files: 0. View PR surface stats
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 HistoryReview history (3 earlier review cycles)
Reviewed October 17, 2026, 10:22 PM ET / October 18, 2026, 02:22 UTC (Revision 4). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9785a1e976
ℹ️ 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".
| if ( | ||
| scope === "system" && | ||
| result.termination === "exit" && | ||
| readSystemctlDetail(result).includes("System has not been booted with systemd") | ||
| ((result.termination === "error" && result.errorCode === "ENOENT") || | ||
| (result.termination === "exit" && | ||
| readSystemctlDetail(result).includes("System has not been booted with systemd"))) | ||
| ) { | ||
| return new ServiceInspectionError("service-manager-unavailable"); | ||
| return new ServiceInspectionError("service-manager-unavailable", result.inspectionDiagnostic); |
There was a problem hiding this comment.
Preserve the missing-busctl diagnosis for system units
When inspecting a system-scope Gateway on a host where systemd/systemctl works but busctl is absent, readLoadedSystemdServiceRuntime calls execBusctlSystem, whose ENOENT result now enters this branch and is mislabeled service-manager-unavailable. The update consequently reports that the system manager is unavailable even though only busctl must be installed; distinguish the executed command here, as systemd-command-query.ts already does for the same failure.
AGENTS.md reference: AGENTS.md:L82-L84
Useful? React with 👍 / 👎.
9785a1e to
d69a80e
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d69a80e612
ℹ️ 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".
| throw new GatewayServiceUpdateOwnershipError( | ||
| serviceUpdateVerdict.kind === "unavailable" | ||
| ? "Gateway service ownership could not be verified because inspection is unavailable. Run `openclaw gateway status --deep` and retry." | ||
| ? `Gateway service inspection is unavailable. Run \`systemctl --user status openclaw-gateway\` and \`openclaw gateway status --deep\` before retrying.\n${serviceUpdateVerdict.message}` |
There was a problem hiding this comment.
Keep unavailable-admission guidance platform-specific
When service inspection becomes unavailable on Windows, macOS, or FreeBSD between admission and revalidation, this cross-platform branch tells the operator to run systemctl --user, which is unavailable there; it also hardcodes the default unit name for profiled Linux installations. Select guidance from the service platform/verdict instead of unconditionally prescribing this command.
AGENTS.md reference: AGENTS.md:L82-L84
Useful? React with 👍 / 👎.
| throw new GatewayServiceUpdateOwnershipError( | ||
| serviceUpdateVerdict.kind === "unavailable" | ||
| ? "Gateway service ownership could not be verified because inspection is unavailable. Run `openclaw gateway status --deep` and retry." | ||
| ? `Gateway service inspection is unavailable. Run \`systemctl --user status openclaw-gateway\` and \`openclaw gateway status --deep\` before retrying.\n${serviceUpdateVerdict.message}` |
There was a problem hiding this comment.
Do not append post-update guidance to a pre-mutation refusal
When an earlier owned verdict becomes unavailable here, the update is refused before package mutation, but ${serviceUpdateVerdict.message} includes GATEWAY_SERVICE_INSPECTION_WARNING, which tells the operator to restart manually “after the update.” This contradicts the unchanged-installation recovery result and can prompt an unnecessary Gateway restart; append only the native inspection diagnostics or use refusal-specific wording.
AGENTS.md reference: AGENTS.md:L82-L84
Useful? React with 👍 / 👎.
| }, | ||
| ); | ||
| if (result.code !== 0 || result.termination !== "exit") { | ||
| failure = formatSystemdProbeFailure(`busctl --user ${checking}`, result); |
There was a problem hiding this comment.
Report the actual machine busctl probe
When the fallback candidate is kind === "machine", the executed command uses busctl --machine <user>@ --user ..., but this records busctl --user machine Manager.Version, a command that was never run and that omits the selected manager target. Build the diagnostic from scope and the actual query arguments so headless-user failures identify the probe that failed.
AGENTS.md reference: AGENTS.md:L82-L84
Useful? React with 👍 / 👎.
…covery failure (openclaw#175928) When systemd service inspection was unavailable, the managed-service preflight refused with a generic 'service-ownership-unverified' message and recovery then reported 'restart-unhealthy' although nothing had been stopped or changed. The refusal now names the failed probe with its exit code and first sanitized stderr line plus the next command to run, and an untouched preflight refusal records that no recovery was needed and the previous version is still serving. Ownership policy is unchanged. Refs openclaw#175869
What Problem This Solves
An update refused before changing its managed Gateway could report a false recovery failure, while unavailable systemd inspection discarded the native cause needed to diagnose it.
Refs #175869. The reporter's Pi root cause remains unknown until its native diagnostic is collected.
User Impact
An untouched managed-service refusal records
No recovery needed; still serving <before>(or honestly reports the unchanged installation when no running observation exists), without arestart-unhealthyverdict. Existing refusal messages and failure facts retain the failed probe, exit/termination, and a sanitized first stderr line, together with the unchanged-installation and inspection guidance.This does not make every unavailable-inspection path refuse safely: the live proof below exposed an existing admission gap, which remains outside this explicitly narrowed patch.
Why This Change Was Made
The native execution owner keeps the bounded diagnostic in the existing inspection error; the existing runtime detail and managed-service failure facts carry it. The recovery owner skips restart verification when nothing was stopped, started, or changed. The failure-fact formatter is consolidated rather than duplicated.
No added retry, process-owner fallback, diagnostic propagation object, option, schema, or dependency. Existing inspection deadlines and user-bus derivation remain unchanged. Production +115/-76 = net +39; tests +126/-27 = net +99, relative to
bbd73bc442f4. The remaining production growth is native diagnostic capture/formatting and the untouched-recovery condition.Evidence
show/cat/is-activediagnostic regressions, untouched recovery, and lost-inspection guidance failed on the untouched base. The deadline regression also failed because the native probe cause was lost.run-tsgo.mjschecks, touched-file oxlint/oxfmt,git diff --check, and Madge passed (0 cycles). Final runtime build passed in 80.6 s; packed-package integrity passed. SQLite inventory was skipped under the campaign's local gate budget; PR CI owns broad checks.update-command-original-service.test.tsspent 180.6 s across 48 cases (maximum 10.7 s);update-command-database-rollback.test.tsspent 177.6 s across 13 cases (maximum 24.5 s). Their retained-service and package/Git/database rollback fixtures repeat real setup per case;update-command-lease.test.tsalso spent 144.1 s across 54 cases (maximum 6.7 s), repeatedly launching its fresh-process lease/Doctor fixture. These suites and their timeouts/assertions were not changed.Live proof and limitation
The isolated package was built with
pnpm build:runtimeand packed with:node --import ./scripts/tsx.mjs scripts/package-openclaw-for-docker.mts \ --skip-build --output-dir "$PWD/.artifacts/l1679-final/live" \ --output-name openclaw-base.tgzInside each isolated container, the principal commands were:
env -u XDG_RUNTIME_DIR -u DBUS_SESSION_BUS_ADDRESS timeout 180 \ openclaw update --yes --tag file:/proof/openclaw-candidate.tgz openclaw update status --json openclaw gateway call health --json openclaw gateway call themes.list --params '{}' --jsonBoth runs used a real built Gateway, isolated HOME/state, port 19879, a canonical fake systemd surface, and a locally packed 2026.10.5 candidate. The update command omitted XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS. One run made native probes unavailable initially; the other retained successful initial inspection and failed probes after candidate cleanup.
Neither run proved safe refusal. Both replaced 2026.10.4 with 2026.10.5 without a native stop/start/restart call. The installation observer requested a supervisor restart (
gateway.installation_replaced), replacing the original process. The bounded commands ended at about 182 s with exit 137 while status still showedrunning/activating; a SIGTERM recovery message was observed, but there was no terminal refusal or recovery result. The precise cause of exit 137 was not established. HTTP health, health RPC, and a firstthemes.listcall (11 themes) passed on the replacement processes, not on a retained old process. Both owned containers were removed.Source diagnosis: the existing package guard requires an installation path from argv, but the Gateway rewrites its process title to
openclaw-gateway; the native-exception path can also return unavailable before checking the retained service admission. Those decisions are unchanged by this patch. Matching PID/start-time/port/systemd-owner evidence was captured before the delayed run. This patch adds no new authority path and makes no claim to fix that separate gap.The initial Bun worker SIGTRAP is a pre-existing intermittent native startup defect, tracked in #175961. Worker/launch/pinned-runtime blobs were unchanged; 600 minimal launches passed, establishing intermittence rather than a repair. No retry, timeout increase, or weaker assertion was added.