Repository navigation
fix(daemon): retain authenticated systemd manager inspection - #145597
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: blocked before merge. Reviewed September 12, 2026, 2:54 AM ET / 06:54 UTC (Revision 3). ClawSweeper reviewWhat this changesRetains an authenticated Linux service-manager connection so command and runtime inspection can continue after its session bus disappears. Merge readiness⛔ Blocked before merge - 3 items remain This remains useful, unsuperseded maintainer-owned work. The re-review found no actionable correctness defect, and the reviewed production files are unchanged. Priority: P2 Review scores
Verification
How this fits togetherDoctor and update recovery inspect the Gateway’s systemd service before permitting maintenance or restart. This change retains the selected manager’s private connection for those reads while preserving separate lifecycle authority. flowchart TD
A[Doctor or update inspection] --> B[Selected session bus]
B --> C[Authenticate original manager]
C --> D[Retain private connection]
D --> E[Recheck identity and authority]
E --> F[Read command and runtime]
F --> G[Existing maintenance and recovery decisions]
Decision needed
Why: Root policy requires this cell, the earlier review requested it, and the current body explicitly excludes it; source inspection cannot establish cross-version recovery. Before merge
Agent review detailsSecurityNone. PR surfaceSource +814, Tests +381, Docs +2. Total +1197 across 18 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain operation-local authenticated reads while demonstrating that published-updater recovery preserves existing service definitions and reaches a healthy Gateway. Do we have a high-confidence way to reproduce the issue? Yes at source level: current-main strict readers require the session bus, so losing it while the original manager survives prevents inspection. The body reports native before/after confirmation; this review did not execute that scenario. Is this the best way to solve the issue? Yes for the bounded repair: retaining the authenticated manager avoids guessing another route and keeps lifecycle authority separate. Complete upgrade safety remains an evidence question. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3d7d21166f09. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
…w#145597) * fix: retain authenticated systemd manager inspection * test: isolate unavailable systemd broker diagnostics
Related: #136203
What Problem This Solves
Fixes an issue where Linux service inspection loses the effective command and runtime when the selected user manager remains alive but its session-bus broker disappears. The manager's private socket is still available, but the existing strict readers cannot use it.
Why This Change Was Made
Authenticate the originally selected local manager while its broker is available, retain its private connection within the existing service-operation lifetime, and use the platform libsystemd typed-read API through the existing Koffi dependency. Revalidate kernel UID/PID and process-start identity; reject a different or replaced manager. Keep this passive binding separate from load/mutation authority.
No dependency, configuration, broker activation, D-Bus protocol implementation, custom-route replacement or local-file-as-effective fallback is added. Unsupported/non-local transports keep their existing adapter. This does not choose an initial manager when its identity was never established, alter later lifecycle-effect routing, or close the independent symptoms in #136203.
User Impact
Strict command, runtime and definition-capability inspection can continue against the same authenticated manager after broker loss. Authored environment values, drop-ins, environment files and unset directives remain intact. Another same-UID manager is not adopted as recovery.
Evidence
Preserved native RED on unmodified
a9ff79407881ec0dd084cdb7d4ac2eeb2719b7e1: systemctl still reached the original private socket after broker loss, while strict command and loaded-runtime inspection failed. No historical254-test baseline replay.Product-source native GREEN on isolated Ubuntu/systemd255: effective command/runtime and writable definition capability survived broker loss on the original manager; a different same-UID private peer, unavailable authored broker, conflicting route and replaced original manager were refused by product code. Passive LoadUnit and a retired inherited update grant stayed denied. Invalid-property recovery, queued deadlines and a bounded stalled handshake passed. Both task-only manager fixtures were cleaned up.
Source-native proof uses a synthetic sleep service, not an installed updater/first-hop driver. It does not establish original-reporter attribution or general XRDP/rollback recovery.
Targeted tests:75 scope/runtime/queue/admission/authority cases,53 strict-command cases,26 state-composition cases and84 definition cases pass (238 distinct selected cases; unrelated name-filtered cases were not run). Reused unchanged-source results are recorded separately from the final64-case follow-up.
Initial service-owner review identified six admission/scheduling defects; all were addressed with focused coverage. Repository-required Autoreview completed its single P0-only pass without findings. Final service-owner source review is clean for all17 candidate files; the last guard regression, full core-test typechecks, dead-export scans, changed-file lint and formatting passed. Exact-head CI remains a separate landing gate.
Hosted Linux CI exposed a subprocess-only diagnostic fixture admitting the runner's real manager. An isolated native trace confirmed the cause. The test-only follow-up models the unavailable native broker, preserves every existing assertion, and passes all5 Doctor diagnostic cases plus type/lint checks on Linux. All previously reviewed production bytes are unchanged; successor exact-head CI remains required.
Prerequisite qualification: successor CI on
11ed727b4bd3failed only the inherited line cap insrc/auto-reply/thinking.test.ts, whose blob was identical on the original base and PR head. Merged upstream PR test(auto-reply): split the thinking directive tests below the line cap #145632 fixes that lint input. GitHub-signed head6b6094d296ccincorporates main and preserves all 18 reviewed file hashes and the original diagnostic assertions. The 238 selected cases and native before/after proof are retained without replay; successor exact-head CI is run34678946551. Published-updater and full-lifecycle coverage remain explicitly unproved.Release-note context: keep Linux service inspection on the authenticated original manager when its session broker is lost during the same operation. No initial-selection or complete-upgrade guarantee.