Repository navigation
fix(daemon): handle multiline commands in systemd discovery - #176469
Conversation
Read complete loaded-unit properties through one pinned native manager connection. Keep typed CLI inspection for supported broker routes, and refuse private-manager substitution when native inspection is unavailable. Preserve multiline argv, manager and bus identity across enumeration, bounded cleanup, and conservative classification of multiple ExecStart commands. Targeted runtime tests and build remain pending remote qualification.
|
🦞👀 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. What this changesThis PR reads loaded systemd commands through typed transport while preserving manager identity and multiline arguments. Example: A loaded worker runs python3 with an argument containing a newline followed by Id=hidden.service.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it repairs a current discovery failure, and the reviewed head has no actionable introduced findings; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherLinux service discovery combines unit files and loaded-manager observations into Gateway candidates consumed by build and update safety checks. flowchart TD
A[Build and update checks] --> B[Gateway service discovery]
B --> C[Loaded unit inventory]
C --> D[Retained native connection]
C --> E[Typed broker CLI adapter]
D --> F[Selected systemd manager]
E --> F
C --> G[Command classification]
Technical reviewBest possible solution: Retain typed inventory in its existing owner, shared CLI decoding, conservative classification, and joined cleanup. Do we have a high-confidence way to reproduce the issue? Current-main property framing exposes the multiline failure directly, and the added regression supplies property-looking argument content; no target code was executed during this read-only review. Is this the best way to solve the issue? Typed reads fix the framing defect at the inventory owner, reuse existing transport owners, and eliminate the redundant maintenance-command query without relaxing conservative discovery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bf9843cf9550. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +193, Tests +429, Other -1. Total +621 across 9 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 HistoryReview history (1 earlier review cycle)
Reviewed October 18, 2026, 5:19 PM ET / 21:19 UTC (Revision 2). |
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
Merged via squash auto-merge.
|
## What Problem This Solves Fixes: Knip `deadcode:exports` on main reports four exports that recent refactors left without a consumer. #176447 does not cover them. ## User Impact No user-visible change. ## Why This Change Was Made - `src/cron/service.test-harness.ts: createCronServiceStateWithJobs`: #175975 removed its last callers, so it is deleted. - `extensions/copilot/src/attempt.test-support.ts: createStubToolBridge`: #176003 added an exported copy that nothing imports, so it is deleted. The file is back to its state before #176003. - `src/daemon/inspect-markers.ts: classifyGatewayCommand`: #176469 removed the only outside import, so it is now module-private. - `src/gateway/server-cron.events.test-support.ts: CRON_WAIT_TIMEOUT_MS`: #176399 removed the last outside caller, so it is now module-private. No ignores were added. ## Evidence - `pnpm run deadcode:exports` on this branch, diffed against main `48439195832`: only these four entries disappear. - `extensions/copilot/src/attempt.test.ts` and `src/daemon/inspect.test.ts` pass in full. `oxfmt` and `oxlint` are clean. Co-authored-by: Ayaan Zaidi <[email protected]>
…#176469) * fix(systemd): inspect loaded commands through typed transport Read complete loaded-unit properties through one pinned native manager connection. Keep typed CLI inspection for supported broker routes, and refuse private-manager substitution when native inspection is unavailable. Preserve multiline argv, manager and bus identity across enumeration, bounded cleanup, and conservative classification of multiple ExecStart commands. Targeted runtime tests and build remain pending remote qualification. * test: remove obsolete systemd mock baseline entry * fix(systemd): preserve inventory errors after joined cleanup
…6562) ## What Problem This Solves Fixes: Knip `deadcode:exports` on main reports four exports that recent refactors left without a consumer. openclaw#176447 does not cover them. ## User Impact No user-visible change. ## Why This Change Was Made - `src/cron/service.test-harness.ts: createCronServiceStateWithJobs`: openclaw#175975 removed its last callers, so it is deleted. - `extensions/copilot/src/attempt.test-support.ts: createStubToolBridge`: openclaw#176003 added an exported copy that nothing imports, so it is deleted. The file is back to its state before openclaw#176003. - `src/daemon/inspect-markers.ts: classifyGatewayCommand`: openclaw#176469 removed the only outside import, so it is now module-private. - `src/gateway/server-cron.events.test-support.ts: CRON_WAIT_TIMEOUT_MS`: openclaw#176399 removed the last outside caller, so it is now module-private. No ignores were added. ## Evidence - `pnpm run deadcode:exports` on this branch, diffed against main `7451c5780e5`: only these four entries disappear. - `extensions/copilot/src/attempt.test.ts` and `src/daemon/inspect.test.ts` pass in full. `oxfmt` and `oxlint` are clean. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes complete Gateway service discovery failing when a loaded systemd command contains valid multiline arguments, which can block build and update safety checks.
User Impact
Service discovery preserves multiline and property-looking argument text and inspects every loaded command. Private-socket managers, including the default root route, require native transport support: disabling native support or lacking its helper reports inspection unavailable. It never silently selects another manager.
Why This Change Was Made
The inventory owner now reads typed D-Bus properties through one retained native connection per scope. It pins the selected manager before enumeration and verifies identity before publishing, including an empty result. This removes the human-readable record parser and redundant command re-query.
Broker routes retain typed CLI compatibility when native support is explicitly disabled or its helper is unavailable before connection ownership. Access, identity, deadline, malformed-response and cleanup failures remain terminal. The shared CLI query and existing command-marker owner keep those decisions in one place.
Production delta: +390/-197, net +193 lines, needed for typed framing and retained manager identity. Tests: +474/-45, net +429. One obsolete mock baseline entry is removed.
Evidence
6a8a28a238a86fc2671d7fa635b46213105b9be1. These covered the originalefc01cdinventory implementation. The subsequent correction preserves cleanup ordering while moving it outsidefinally, records the cleanup cause, and renames a test parameter; fresh hosted CI covers that exact head.6a8a28ain 500 seconds, before the small cleanup-flow correction, with the same dependency and build inputs. The first attempt hit the proof container's 12 GiB memory cap; a build-only retry passed after setting the existing build-owned V8 budget to 4,352 MiB. No tests were replayed. The old-head CI identified one obsolete mock baseline entry and four lint errors; both are corrected. Formatting, privacy, diff and native staged line-cap checks passed. No qualified local workspace dependencies were available for a new runtime/type-aware lint run; exact-head hosted CI is required before landing.Named follow-up: artifact ownership checks for completed wrapper services need a credential-free observation of process and pending-job occupancy. Unknown wrapper locations currently remain conservative refusals; this transport repair preserves that boundary.
Retained integration build trace
Selected original build output from
6a8a28a, before the small cleanup-flow correction:The controller's corresponding terminal receipt:
{"kind":"proof-phase-result","utc":"2026-10-18T20:51:45.349493+00:00","phase":"full-build","exit":0,"elapsedSeconds":500.02406036900356,"summary":[],"failedTestFiles":[],"errorCategories":[],"errorCodes":[],"lastBuildPhase":"phase","childJoined":true,"privateLogCapped":false}The retained log has no separate command banner or fence-admission line. These are selected build-entrypoint and terminal records, not a production update trace. Fresh CI owns verification of the corrected head.
Review rank-up disposition: the requested inventory-admission trace was not retained by the completed build, whose normal output does not print that observation. An additional trace run is skipped to avoid repeating completed private-host proof solely for logging. The live inventory result, boundary regressions, retained build and exact-head CI remain distinct evidence; the build receipt is not claimed to prove inventory admission or production recovery.