Skip to content

refactor(daemon): consolidate system ownership formatting - #135283

Closed
vincentkoc wants to merge 1 commit into
mainfrom
refactor/daemon-system-ownership-format
Closed

vincentkoc wants to merge 1 commit into
mainfrom
refactor/daemon-system-ownership-format

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Resolves duplicated daemon-owned formatting policy for POSIX shell arguments and bounded system-ownership failure details. The copies spanned launchd, systemd, cleanup hints, and service layout output, creating avoidable drift risk.

Why This Change Was Made

One private daemon leaf module now owns the existing shell-quoting and failure-detail formatting contracts. Launchd, systemd, inspection, and service-layout callers reuse it without changing Windows behavior, public APIs, SDK surfaces, dependencies, or persistence.

User Impact

No user-visible behavior changes. Operator-pasteable commands and system-ownership diagnostics retain their existing quoting, sanitization, truncation, and recovery text.

Evidence

  • Focused daemon suites: 84 passed, 5 platform-specific skips.
  • Changed-file dry run selected only core production and core tests. Every selected gate before dead-export scanning passed; after adding the omitted tracked UI config paths to the sparse checkout, the exact dead-export lane passed with zero entries.
  • pnpm check:import-cycles: 0 runtime value cycles.
  • pnpm check:madge-import-cycles: 0 cycles.
  • pnpm build completed compilation and artifact generation, then the shared checkout's linked @openclaw/ai artifact failed runtime postbuild because it predated a current diagnostics export. Re-running the exact native-require verifier against the freshly built task-local package passed all 53 built plugin control-plane modules and doctor closures.
  • Exact Codex autoreview with gpt-5.6-sol at high reasoning: scoped clean, no accepted or actionable findings, correctness confidence 0.99.
  • Production LOC: +37/-49, net -12. Tests: +0/-0.
  • Overlap checked against main snapshots ae24725490eed59d55c290a42b33c6d1081791b5 and ef44eab5ed8320cd5a5f34d790cedceffaefc36f; neither changed the affected daemon paths. Open PRs fix(systemd): stop leaking live gateway tokens through readable .service.bak files #131786 and fix(daemon): install gateway LaunchAgent on boot volume #133215 touch separate inspect.ts regions.

@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc vincentkoc self-assigned this Sep 1, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 1, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 12:06 PM ET / 16:06 UTC.

ClawSweeper review

What this changes

The PR centralizes POSIX shell quoting and sanitized ownership-error formatting used by launchd, systemd, service inspection, and service-layout output.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No introduced correctness or security defect was found: the PR extracts byte-equivalent daemon formatting policy into one private module. It is MEMBER-authored and carries the protected maintainer label, so it should remain open for normal draft review.

Priority: P3
Reviewed head: db3ac52bd8c03b01de3bb8536d47fbf2da9132e9

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused behavior-neutral refactor with no supported correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored internal refactor changes no visible product behavior; the focused-suite results stated in the PR are supplemental validation, not a contributor proof gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored internal refactor changes no visible product behavior; the focused-suite results stated in the PR are supplemental validation, not a contributor proof gate.
Evidence reviewed 4 items Equivalent extraction: The new formatter preserves the removed POSIX-safe character set, single-quote escaping, log sanitization, and UTF-16 truncation; every introduced caller change is a direct substitution.
Operator-facing callers: The extracted helpers remain behind service inspection, ownership refusal, status, and Doctor recovery paths; existing daemon tests cover quoted cleanup commands and ownership recovery output.
Current-main check: Fetched current main does not contain the new shared formatter and does not contain the PR head, so the refactor is neither merged nor obsolete.
Findings None None.
Security None None.

How this fits together

Gateway service setup checks whether an operating-system service already owns the Gateway before changing user-level service files. The reviewed helpers format safe recovery commands and bounded diagnostics for operators.

flowchart LR
  A[Service metadata] --> B[Ownership detection]
  C[Filesystem and service errors] --> B
  B --> D[Shared formatting]
  D --> E[Safe shell commands]
  D --> F[Recovery diagnostics]
  E --> G[Operator action]
  F --> G
Loading

Before merge

  • Complete next step (P2) - The PR is maintainer-authored, has a protected maintainer label, and requires ordinary draft review rather than a repair job.
Agent review details

Security

None.

PR surface

Source -12. Total -12 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 5 37 49 -12
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 37 49 -12

Review metrics

Metric Value Why it matters
Production-versus-test delta production net -12; tests unchanged The extraction removes duplicate production policy without adding test-only or public API surface.

Technical review

Best possible solution:

Keep one private daemon-owned formatter for the repeated policy and land the refactor through the normal draft-review path.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR refactors existing formatting behavior rather than reporting a user-facing defect.

Is this the best way to solve the issue?

Yes: a single private daemon leaf module removes repeated policy while preserving the existing callers and ownership boundaries.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1b236dfc8625.

Labels

Label changes:

  • add P3: This is a small internal cleanup with no introduced user-facing capability or behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored internal refactor changes no visible product behavior; the focused-suite results stated in the PR are supplemental validation, not a contributor proof gate.

Label justifications:

  • P3: This is a small internal cleanup with no introduced user-facing capability or behavior change.
  • 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: This MEMBER-authored internal refactor changes no visible product behavior; the focused-suite results stated in the PR are supplemental validation, not a contributor proof gate.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Harjoth Khara: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@vincentkoc

Copy link
Copy Markdown
Member Author

Closing under the current refactor sponsorship policy. This is a behavior-neutral refactor with no linked active fix or deliverable and no durable human-maintainer sponsorship for this exact objective. The objective is retired from the current portfolio; current main has not absorbed this patch. Reopen or reconstruct only when a maintainer ties this exact refactor to a concrete active fix or deliverable.

Open #133215 touches separate daemon logic and does not depend on this extraction.

@vincentkoc vincentkoc closed this Sep 4, 2026
@RomneyDa
RomneyDa deleted the refactor/daemon-system-ownership-format branch October 22, 2026 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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