Skip to content

fix(daemon): retain authenticated systemd manager inspection - #145597

Merged
fuller-stack-dev merged 3 commits into
mainfrom
fix/systemd-retained-private-peer-136203
Sep 12, 2026
Merged

fuller-stack-dev merged 3 commits into
mainfrom
fix/systemd-retained-private-peer-136203

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

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 11ed727b4bd3 failed only the inherited line cap in src/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 head 6b6094d296cc incorporates 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 run 34678946551. 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.

@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Sep 12, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 12, 2026, 2:54 AM ET / 06:54 UTC (Revision 3).

ClawSweeper review

What this changes

Retains 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
Reviewed head: 6b6094d296cc7319c7ff482d4c13f22ca09d3a9c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent repair with meaningful boundary coverage and no actionable code findings; upgrade acceptance remains separate.
Proof confidence 🌊 off-meta tidepool Not applicable: The member-authored PR is exempt from the ordinary contributor-proof gate. Its captured body reports native Ubuntu/systemd255 recovery and rejection observations through the changed readers; the separate repository-required published-updater cell remains unresolved.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored PR is exempt from the ordinary contributor-proof gate. Its captured body reports native Ubuntu/systemd255 recovery and rejection observations through the changed readers; the separate repository-required published-updater cell remains unresolved.
Evidence reviewed 9 items Re-review continuity: The comparison returned no differences in the daemon, diagnostic fixture, or changed documentation since the previous reviewed head. Its one retained rank-up request concerned published-updater compatibility; the current captured body explicitly says that coverage remains unproved.
Current main still requires the broker: Current-main command and loaded-runtime queries use execBusctlUser without the retained private connection. No same-repository merged fixing PR was established for this behavior.
Latest release comparison: The v2026.9.4 service-state reader has no retained-manager admission or binding propagation, so the latest supplied release does not establish this fix.
Findings None None.
Security None None.

How this fits together

Doctor 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]
Loading

Decision needed

Question Recommendation
Must the published-driver × candidate Linux recovery cell be completed before landing, or will the service/update owner explicitly accept an exception? Complete the upgrade cell: Record a published updater exercising candidate Doctor/service recovery with existing operator state and an observed healthy outcome.

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

  • Resolve merge risk (P1) - Native admission now precedes strict Doctor/update reads, but compatibility with an installed published updater remains unproved. An integration or deadline failure could block recovery before the Gateway restarts.
  • Complete next step (P2) - Provide the required published-driver × candidate Linux update/Doctor recovery evidence, or record an explicit owner-approved exception to that gate.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +814, Tests +381, Docs +2. Total +1197 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 11 886 72 +814
Tests 6 382 1 +381
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 1270 73 +1197

Review metrics

Metric Value Why it matters
Net production and test growth Production +814 lines; tests +381 lines Production growth implements retained native transport, identity checks, and lifetime management; the body explains that responsibility.

Merge-risk options

Maintainer options:

  1. Verify the published updater boundary (recommended)
    Complete the repository-required upgrade cell before relying on retained inspection during recovery.
  2. Accept a bounded coverage exception
    A service/update owner can explicitly accept the remaining upgrade uncertainty without claiming complete recovery coverage.

Technical review

Best 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.

Labels

Label justifications:

  • P2: This is a bounded Linux inspection reliability repair rather than an established urgent regression.
  • merge-risk: 🚨 compatibility: Strict recovery reads gain a native admission stage without published-updater compatibility evidence.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The member-authored PR is exempt from the ordinary contributor-proof gate. Its captured body reports native Ubuntu/systemd255 recovery and rejection observations through the changed readers; the separate repository-required published-updater cell remains unresolved.

Evidence

What I checked:

  • Re-review continuity: The comparison returned no differences in the daemon, diagnostic fixture, or changed documentation since the previous reviewed head. Its one retained rank-up request concerned published-updater compatibility; the current captured body explicitly says that coverage remains unproved. (src/daemon/service.ts:229, 6b6094d296cc)
  • Current main still requires the broker: Current-main command and loaded-runtime queries use execBusctlUser without the retained private connection. No same-repository merged fixing PR was established for this behavior. (src/daemon/systemd-service-files.ts:110, 3d7d21166f09)
  • Latest release comparison: The v2026.9.4 service-state reader has no retained-manager admission or binding propagation, so the latest supplied release does not establish this fix. (src/daemon/service.ts:208, 3a9d69db306c)
  • Upgrade gate applies to the changed entry point: Strict state reads now perform native admission within their deadline before the existing readers. Doctor finish and update maintenance consume this path. Root policy requires published-driver × candidate proof for Doctor/service changes; the PR body expressly excludes an installed updater from its native fixture. (src/daemon/service.ts:229, 6b6094d296cc)
  • Retained identity and final-I/O checks: Admission checks broker-selected UID/PID and process-start identity against the private peer. Queries remain unit-bound; LoadUnit requires separate current inspection authority, and queued native execution rechecks update authority and peer credentials before I/O. Definition writes retain their existing independent inspection owner. (src/daemon/systemd-peer-native.ts:131, 6b6094d296cc)
  • Native dependency contract: The patch directly binds libsystemd’s sd-bus API. The v255 header confirms PID and EUID credential bits combine to 17 and declares the property, credential, and basic-value APIs used by the adapter. (src/systemd/sd-bus.h:59, db11bab38ccf)

Likely related people:

  • fuller-stack-dev: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Record published-driver × candidate Linux service recovery evidence with private details redacted, or obtain an explicit owner-approved exception.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-12T04:50:21.515Z sha 1132326 :: blocked before merge. :: none
  • reviewed 2026-09-12T05:06:59.806Z sha 11ed727 :: blocked before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the commands Command implementations label Sep 12, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 12, 2026
@fuller-stack-dev
fuller-stack-dev merged commit cfa99bb into main Sep 12, 2026
187 checks passed
@fuller-stack-dev
fuller-stack-dev deleted the fix/systemd-retained-private-peer-136203 branch September 12, 2026 07:09
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant