Repository navigation
fix(cli): surface stale-updater launchd scan failures in deep status - #195977
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. |
ace22b8 to
5ac6744
Compare
5ac6744 to
992caad
Compare
|
@clawsweeper re-review. |
|
🦞👀 Re-review progress:
|
|
Codex review: needs real behavior proof before merge. What this changesThis PR makes deep Gateway status report failures to inspect stale macOS updater launchd jobs. Example: On macOS, launchctl list exits 1 with Operation not permitted.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it fixes a current diagnostic failure, and no concrete patch defect was found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGateway status gathers launchd diagnostics using the installed service environment and projects discovered jobs or inspection errors into terminal and JSON output. flowchart TD
A[Gateway status CLI] --> B[Status gatherer]
B --> C[Launchd diagnostics]
C --> D[Updater job scanner]
D --> E[launchctl list]
E --> C
C --> F[Terminal and JSON output]
Technical reviewBest possible solution: Keep the focused error channel and warning in the existing status owners. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the failure: the scanner throws on a nonzero launchctl exit, while deep status catches that rejection as an empty result; no target code was executed. Is this the best way to solve the issue? The patch restores the missing distinction between an empty scan and a failed scan through existing diagnostics and rendering owners; the small helper and test extraction fit the documented file-cap constraints. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against cbe182f49c4c. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +26, Tests +53, Other +5. Total +84 across 7 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 November 9, 2026, 8:39 AM ET / 13:39 UTC. |
|
Thanks, @shuisadev, merged as fee857b with your authorship credited. |
…penclaw#195977) On macOS, `openclaw gateway status --deep` showed nothing when the stale-updater launchd scan failed, so "could not inspect" looked identical to "no stale jobs". The failure is now recorded (redacted) and printed alongside the existing foreign-job inspection warning. Follow-up to openclaw#195744. Co-authored-by: SunnyShu <[email protected]>
A failing systemd installation probe was swallowed via .catch(() => null), so a host with a conflicting systemd scope saw 'all good' in 'status --deep' while 'openclaw doctor' would flag it (same silent-swallow class as openclaw#195977). - Record the redacted error as gateway.duelingScopesWarningError and print a warning in 'status --deep' that names the skipped diagnosis and the remedy. - Stop swallowing the same probe failure in gateway-cli/run.ts: log it with the same recovery step instead of dropping it. - Move the dueling-scope inspection/print logic and its tests into sibling modules to stay within the per-file line-cap ratchet.
What Problem This Solves
openclaw gateway status --deepon macOS reports a clean bill of health when the stale-updater launchd scan fails. Since #195744,findStaleOpenClawUpdateLaunchdJobsthrows whenlaunchctl listfails, butgatherLaunchdJobDiagnosticsstill folds that failure into an empty array with.catch(() => []).if (stale.length)then adds nothing to the diagnostics object and the terminal prints no warning, so "could not inspect" and "no stale jobs left" are byte-for-byte identical to the user.LaunchdJobDiagnostics, even though the siblingfindForeignLaunchdJobsbranch in the same function writesforeignLaunchdInspectionErrorand printsCould not inspect foreign launchd jobs: ....staleLaunchdInspectionError(redacted through the sameredactSupportDiagnosticLineowner used by fix(commands): warn when the macOS stale-updater launchd scan fails instead of reporting healthy #195744), and render it via a shared launchd inspection warning list.status.launchd.ts(new field plustry/catch),shared.ts(resolveLaunchdInspectionWarningsfor both inspection warnings),status.print.ts(one loop replacing one branch), and focused regressions.Why This Change Was Made
The scanner fix in #195744 made scan failures observable for
openclaw doctor, butstatus --deepis the documented entry point for diagnosing an interrupted update and still swallowed the same error. Reusing the existingprintWarningtemplate and the canonical redaction owner keeps the two outputs consistent: both now say the leftovers were NOT checked instead of implying a healthy host.foreignLaunchdInspectionErrorchannel is the smallest change that gives the failure a durable place in the diagnostics object, including--jsonoutput.gatherLaunchdJobDiagnosticswas rejected because everygateway statusinvocation would fail for an advisory scan, and a dedicated warning field would still be needed for the print layer.printWarninginstatus.print.tswas rejected because that file is already at its 700-line cap; consolidating both inspection warnings intoshared.tskeeps it under the cap.status.gather.test.tsis also at its line cap, so its launchd cases were extracted into a sibling*.test-support.tsmodule; this required an exact test-line allocation.User Impact
macOS operators running
openclaw gateway status --deepafter a failed or interrupted update now see an explicit warning instead of a false clean result:The same detail is available in
--jsonasservice.staleLaunchdInspectionError. When the scan succeeds, output is unchanged. The pre-existing foreign-launchd-jobs warning is unchanged.Evidence
Real runtime verification used
node --import tsxwith an ESM resolve hook that replaces only the two launchctl IO boundary modules (daemon/launchd.js,daemon/launchd-foreign-jobs.js) with stubs that makelaunchctl listreject. The production functionsgatherLaunchdJobDiagnostics,resolveLaunchdInspectionWarnings, andprintDaemonStatusare imported and executed unchanged;process.platformwas not patched.Command (production sources reverted to
origin/mainfor the pre-fix run, then restored for the post-fix run, using the same input):$ node --import tsx --import ./register.mjs ./probe.mtsPre-fix, with the production sources at
origin/main:Post-fix, same input:
Shipped-entry before/after comparison for the same
launchctl listrejection. Both runs use the identical probe and an isolated state dir (HOMEandOPENCLAW_STATE_DIRpoint at a temporary directory); the only difference is the production sources, frozen atorigin/mainfor "Before" versus the candidate commit for "After". Each column was produced by a separatenode --import tsxinvocation, and the verbatim terminal output for both is pasted above.origin/main)gatherLaunchdJobDiagnostics(env, true)result{}{ "staleLaunchdInspectionError": "launchctl list failed (exit 1): Operation not permitted" }staleLaunchdInspectionErrorkey presentfalsetruestaleUpdateLaunchdJobskey presentfalsefalseresolveLaunchdInspectionWarningswarning count01--deepwarning lineCould not inspect stale OpenClaw updater launchd jobs: ...; interrupted-update leftovers were NOT checked ...--jsonservice.staleLaunchdInspectionErrorCould not inspect foreign launchd jobs: ...The control rows are the regression guard: the fix only adds a failure channel and does not alter the success path or the pre-existing foreign-jobs warning.
Focused tests (both cases now run on Linux; the previous stale-scan case was gated by
it.runIf(process.platform === "darwin")and skipped in CI):Individual cases:
Repository gates, all passing after rebasing onto the latest
origin/main:Open PR collision check: on the submission-day open-PR snapshot, changed-file lists were compared for
status.launchd.ts,status.print.ts,status.gather.ts,daemon-cli/shared.ts, andlaunchd-update-jobs.ts; no open PR touches them, and no open PR title covers deep-status launchd or stale-updater scans. #195744 (merged) changed the scanner and the doctor warning; this PR only wires the same failure intostatus --deep, so it is a follow-up consumer fix, not a duplicate.What was not tested: a real macOS host with a genuinely failing
launchctl(the Linux run substitutes only the launchctl IO boundary), and an actual interrupted-update leftover plist. The successful-scan path was covered by the existing regression plus a control case.