Skip to content

refactor(cli): centralize daemon action output - #150047

Merged
steipete merged 8 commits into
mainfrom
codex/daemon-output-owner-20260914
Sep 22, 2026
Merged

steipete merged 8 commits into
mainfrom
codex/daemon-output-owner-20260914

Conversation

@steipete

@steipete steipete commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Daemon service commands repeat human-readable success and install-warning rules across callers.

User Impact

No intended behavior change: CLI text, JSON output, warning order, and exit codes remain unchanged.

Why This Change Was Made

Explicit success messages now come from the existing daemon action context, and the install context owns warning accumulation. This removes 37 net production lines across six modules.

Generic emission remains JSON-only. Empty and duplicate warnings, order, failure handling, lazy definition-backup lookup, emission-time rebind receipts, and restart health ordering are preserved. Standalone still-starting retains exit 2; updater restart-health-failed retains exit 1. Runtime pins, definition repair, readiness, and update authority keep their existing owners.

Evidence

CI 35717734554 passed on reviewed head 5c9d0a3767ddd297cda450ea234de5aec47dbaa5, attempt 1: 120 successful jobs, 17 skips, and both required CI-gate surfaces green. Checkout logs bind the tests to merge c9c233acd7d31d15c3fb5fbb61d6d9b43ca24de9 with actual main parent 771a42dab0edefd4cc09fde1d7bb4728d38560f4; all 13 PR files and 47 recorded output/service inputs match. All 116 changed-file cases passed without skips. Their reported CI case-duration sums were response 0.028 s, lifecycle output 0.053 s, install output 2.075 s, external supervision 0.027 s, Gateway owner 0.351 s, and node daemon 0.579 s; these exclude shared import/transform/setup/teardown overhead. The full CLI lane passed 9,077 cases with 51 existing skips in 301.78 s command wall.

Both formerly failing cases are now directly verified with their canonical fixes incorporated: included-config reload passed in 1.306 s (995 cases in its current group), and SSH key-match pairing passed in 0.497 s (795 cases in its auth/node group). Their earlier failures and diagnostic limits remain historical evidence. ClawSweeper reviewed this exact head with no correctness/security findings or before-merge items. This CI result adds no claim of a new packaged-update execution or native cross-platform proof; the separately qualified earlier output and updater-owner evidence retains its original source, driver, and schema-observation limits.

The sealed integration is 5c9d0a3767ddd297cda450ea234de5aec47dbaa5, a normal merge of canonical main ca97ceb8f9bd712205da7fef9c65eb99c5cc6f45 into published head 35febf3aa058660b2aed25313eceaf85a84769b2. Original PR ancestry is preserved. All 13 PR files and all 47 recorded output/service proof inputs remain unchanged from the preceding integration. The output patch is byte-identical to the independently reviewed checkpoint 310fdf0b40f1b67377db560806cc2a306a084d9f.

  • Independent P2 review of the output patch and its fixture-only repair completed without actionable findings. No substantive author delta was introduced by the later main integrations.
  • The same 15 owner/sibling suites passed 277/277 baseline and 277/277 candidate cases, with identical inventories and no skipped cases. The unchanged response baseline's 16 cases were reused after source/import/toolchain checks, with Node 24.19.0 and pnpm 12.4.0.
  • The complete registered core/core-test gate passed at the schema-17 output checkpoint: all 25 typecheck graphs, changed-path lint, dead-export scans, and runtime import-cycle checks. This is historical checkpoint evidence, not CI for the latest integration.
  • Prior head 7e59fc0a92e653f7ba24a6ff49470207febc2ed7 passed the genuine published 2026.9.5 first-hop lane in 735.360 s: canonical package build, integrity checks, and both positive update hops. Both recorded fresh Doctor-finalize workers exited 0, the expected build reached readyz and settled status, and no plugin errors or transaction residue remained. This result qualifies the unchanged output contract; no package built from the latest integration has been executed.

The first baseline run exposed a stale restart fixture: loaded native restarts supplied no installed command, and the mock omitted two current restart-intent exports. The existing fixture now supplies those values for loaded rows; unloaded/recovery rows still return null. No assertions, cases, ordering, deadlines, or production behavior were weakened. The full 28-case fixture then passed on both sides.

Measured test cost

These are isolated Testbox command-wall seconds for pnpm test <file> --maxWorkers=1 --reporter=json --outputFile <report>. Baseline totals 192.938 s, including the reused 2.044 s response result; candidate totals 206.315 s. They characterize behavior and test cost, not a speedup.

Suite Cases Baseline s Candidate s
src/cli/daemon-cli/response.test.ts 16 2.044 2.131
src/cli/daemon-cli/lifecycle-core.output.test.ts 28 15.556 13.332
src/cli/daemon-cli/install.output.integration.test.ts 4 15.814 17.506
src/cli/daemon-cli/lifecycle.external-supervision.test.ts 15 15.311 17.741
src/cli/daemon-cli/lifecycle.gateway-owner.test.ts 4 15.149 17.649
src/cli/node-cli/daemon.test.ts 49 13.174 14.513
src/cli/daemon-cli/lifecycle-readiness.test.ts 7 14.432 15.323
src/cli/daemon-cli/install.definition-repair.test.ts 13 17.249 17.756
src/cli/daemon-cli/install.reinstall.test.ts 24 12.896 13.989
src/cli/update-cli/update-command-service-command.test.ts 9 13.761 14.543
src/daemon/runtime-pin-state.test.ts 3 13.371 15.286
src/daemon/runtime-pin-service.test.ts 9 14.143 14.775
src/daemon/service-rebind.test.ts 9 2.092 2.232
src/cli/daemon-cli/register-service-commands.test.ts 47 14.735 15.233
src/cli/node-cli/register.test.ts 40 13.212 14.305

Hosted CI and canonical fixture repairs

CI 35712514357, attempt 1, tested published 35febf3 through merge a6115dace71c4aa687118537fe8f35aa7a2edbd7, whose actual main parent was 41f119f66004c2944a79e1aaede0bc77dd35c4d2. Checkout logs and immutable commit metadata agree.

All 116 changed-file cases passed, with no skips. The complete CLI lane passed 9,044 cases with 51 existing skips: 303.69 s command wall and 359 s job wall. Summed per-file CI case durations were response 0.024 s, lifecycle output 0.144 s, install output 2.511 s, external supervision 0.042 s, Gateway owner 1.238 s, and node daemon 0.583 s. These sums exclude shared import/transform/setup/teardown overhead.

That run remains failed: 118 jobs succeeded, 17 were skipped, and one SSH-pairing shard plus the aggregate gate failed. server.node-pairing-ssh-verify.test.ts:178 expected the first connect to be rejected, but its immediate mocked approval had already landed. The group passed 794 other cases. Canonical main fix f87f23c483b4c5130f42f2451f0b03e36ea0effe, now incorporated, holds the existing deferred probe until pending/retry-hint assertions finish, then preserves the persisted approval, second handshake, and capability assertions. Its owner reproduced the original full-file order and passed 50 focused cases in 119.25 s, lint, and independent review. Runtime logic and deadlines are unchanged. No blind CI retry was requested.

The earlier CI 35698558705 failed in the included-config reload fixture. Its bounded diagnostic passed but did not explain the failure. Canonical 97e9ce9bf66609a4c0667aa59f67d6206e95c543 later reproduced the assertion's five-second deadline expiring behind the real lifecycle lease and repaired it by awaiting the existing publication signal while preserving the exact-once callback check. The actual named case passed in 1.374 s in the newer CI run; its current hosted-7 group passed 995 cases. The group moved from large-18 to large-19, so this statement is bound to the explicit case, not the old job number. Both original failures and diagnostic limitations remain retained.

ClawSweeper's exact 35febf3 review reported no correctness/security findings or before-merge items. Fresh-head CI and native maintainer gates passed for 5c9d0a3; the PR landed as 05a0b7be36e7f53d4bf12c4d9672e9fc0a0ef635.

Inherited updater changes and proof limits

This PR authors no schema, configuration, or updater-policy change. Current main declares state/agent schemas 18/23. Earlier inherited Doctor/cache/parser changes retain their source-bound owner proof. Retained-deletion fixtures were absent from the prior standard update cell, which is not presented as coverage of those separate branches.

The latest integration includes #153764, which preserves structured update failures and the running updater's worker generation during replacement. All 64 of that owner's source/test paths match its exact tested candidate f4291a7463b6dc2d1320174b591ed6d31fd59b19; the 65th path is a wrapper manifest whose only additional line is the already repaired SQLite maintenance-cache import. The nearby coordinator change 6110505e6d47 adds lifecycle-owned idle-pool cleanup while preserving scoped disposal and checked-out custody, with its own failing control, repeated owner tests, changed checks, and review. Worker URL capture, reply settlement, native exit callbacks, and the direct service-child output caller receive no change from this PR.

The updater owner's canonical compiled package passed generation retention across distribution replacement, synthetic pressure/reopening, prepared reads, accepted-write drainage, restoration, and the actual sealed service-child registration entrypoint. This is Linux/Node proof with synthetic pressure, not OOM or cross-platform proof. Its optional-fetch negative control produced exactly the two intended stale-branch failures while both tag controls passed; source/runtime were restored.

A genuine published 2026.9.2 driver updated to that exact owner package and exited 0. Native service readiness, unchanged session metadata, both transcript messages, and agent schema 19→23 were recorded. The overall initial qualification remains failed: its immediate PRAGMA user_version check expected 18 but observed 15. A separate read-only observation on the same database inode and serving process confirmed content schema 18 was recorded before terminal update success, then both published markers reached 18 after the existing five-minute publication delay. The updater was not replayed; service cleanup and lease release were verified. The package's version is 2026.9.5; it was not a published-2026.9.5 driver cell, and no such cell is claimed for f429 or this latest head.

The retained prior-head 2026.9.5 output/update cell uses a systemctl shim launching the real Gateway, not native systemd/macOS/Windows proof. Its first-hop fixture changes version/inventory metadata; the second also removes legacy compatibility chunks. Healthy activation can avoid the restart path, so paired tests separately cover restart/node output and serialization. No direct persisted-schema snapshot or deterministic 9.5 missing-chunk negative control was retained. The source, artifact hashes, command receipts, and cleanup evidence remain separate from fresh-head CI and enforced merge gates.

Keep generic result emission JSON-only and route message-bearing successes
through the action context. Bind install warnings once in the shared install
context while preserving warning order and lifecycle exception boundaries.

Characterize human and JSON output through the existing response owners,
including foreground restart health ordering and install warning behavior.
@clawsweeper

clawsweeper Bot commented Sep 16, 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.

@steipete
steipete marked this pull request as ready for review September 16, 2026 12:31
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XL maintainer Maintainer-authored PR labels Sep 16, 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 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 6:53 AM ET / 10:53 UTC (Revision 8).

ClawSweeper review

What this changes

Centralizes Gateway and node service success messages and install warnings in existing CLI helpers while preserving text, JSON output, warning order, and exit behavior.

Merge readiness

✅ Ready for maintainer review

Keep open as useful, maintainer-owned cleanup that current main has not incorporated. No introduced correctness or security defect was found.

Priority: P3
Reviewed head: 5c9d0a3767ddd297cda450ea234de5aec47dbaa5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving consolidation with useful characterization coverage and no actionable introduced defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor gate does not apply to this maintainer-owned refactor. Retained prior-head update observations supplement output tests; the changed production files are unchanged, but latest-head runtime execution and native cross-platform coverage are not claimed. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor gate does not apply to this maintainer-owned refactor. Retained prior-head update observations supplement output tests; the changed production files are unchanged, but latest-head runtime execution and native cross-platform coverage are not claimed. No stored-data contract changes.
Evidence reviewed 8 items Introduced production change: The pinned base-to-head diff moves existing emission rules into the action context and migrates their callers. Generic emit remains JSON-only; failure handling, service mutations, authority checks, and health ordering are unchanged.
Review continuity: Comparison with the preceding reviewed head produced no changes under either affected CLI directory. The prior completed review contained no findings or published rank-up moves.
Still distinct from main and release: Fetched main retains the separate message helper and caller-owned install warnings. The latest release also retains emitDaemonActionMessage rather than the proposed context-owned emitMessage.
Findings None None.
Security None None.

How this fits together

Gateway and node service commands pass installation and lifecycle results to shared CLI response helpers. These helpers produce human-readable messages or machine-readable JSON after the existing service and health checks.

flowchart TD
  A[Gateway and node commands] --> B[Service lifecycle operations]
  B --> C[Existing verification and health checks]
  C --> D[Shared action context]
  E[Install warnings] --> D
  D --> F[Human-readable output]
  D --> G[JSON response and exit status]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -37, Tests +948. Total +911 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 6 60 97 -37
Tests 7 950 2 +948
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 1010 99 +911

Review metrics

Metric Value Why it matters
Production versus test growth Production −37 net lines; tests/support +948 net lines The implementation shrinks; branch growth is output-contract characterization with measured execution costs recorded in the PR.

Technical review

Best possible solution:

Keep output policy in the existing action context while service, readiness, and update owners retain their current responsibilities.

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

Not applicable: this refactor reports no broken user behavior; source comparison and characterization tests address preservation of existing output.

Is this the best way to solve the issue?

Yes: moving repeated emission rules into the existing response owner is a narrow consolidation, and the inspected callers preserve their exception and health-check boundaries.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 45ba3419d63e.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal CLI cleanup with no intended change to user-visible behavior.
  • 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 ordinary external-contributor gate does not apply to this maintainer-owned refactor. Retained prior-head update observations supplement output tests; the changed production files are unchanged, but latest-head runtime execution and native cross-platform coverage are not claimed. No stored-data contract changes.

Evidence

What I checked:

  • Introduced production change: The pinned base-to-head diff moves existing emission rules into the action context and migrates their callers. Generic emit remains JSON-only; failure handling, service mutations, authority checks, and health ordering are unchanged. (src/cli/daemon-cli/response.ts:187, 5c9d0a3767dd)
  • Review continuity: Comparison with the preceding reviewed head produced no changes under either affected CLI directory. The prior completed review contained no findings or published rank-up moves. (src/cli/daemon-cli/response.ts:187, 5c9d0a3767dd)
  • Still distinct from main and release: Fetched main retains the separate message helper and caller-owned install warnings. The latest release also retains emitDaemonActionMessage rather than the proposed context-owned emitMessage. (src/cli/daemon-cli/response.ts:103, ec9c1a13db89)
  • Output contract coverage: Reviewed tests cover human/JSON parity, empty and duplicate warnings, native and recovery routes, health-before-success ordering, and output-sink failures. The captured body reports 277 baseline and 277 candidate cases across 15 suites with measured costs. Tests were not executed during this read-only review; git diff --check passed. (src/cli/daemon-cli/lifecycle-core.output.test.ts:112, 5c9d0a3767dd)
  • Historical runtime evidence and inspection limit: The captured body reports a published-2026.9.5 driver updating to prior head 7e59fc0, reaching readiness with successful Doctor-finalize workers. The six changed production modules match that head. The body explicitly limits this to a systemctl shim and excludes latest-head package execution. Linked workflow metadata reports an overall cancelled run; raw job logs redirect to a host-blocked domain, so the individual proof-cell result was not independently inspected. (7e59fc0a92e6)
  • Related updater work is separate: fix(update): preserve failures and running worker code during replacement #153764 is verified merged at dd7d596. Its updater changes are inherited base context, not introduced by this output refactor, and do not establish a new schema or authority change here. (dd7d596ed3ea)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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.

History

Review history (7 earlier review cycles)
  • reviewed 2026-09-16T12:50:53.451Z sha c4fc532 :: blocked before merge. :: none
  • reviewed 2026-09-17T08:34:12.597Z sha abfe06c :: blocked before merge. :: none
  • reviewed 2026-09-17T21:05:24.587Z sha b23f1b8 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-18T10:46:35.987Z sha b23f1b8 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T07:21:52.071Z sha 7e59fc0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T09:21:33.620Z sha 7e59fc0 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-22T09:59:03.744Z sha 35febf3 :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Please refresh the review for unchanged head b23f1b8ecb7ad7e5ff29d1851e9953f8d8bde167: the latest completed review (2026-09-17 21:05 UTC) is now older than 12 hours. Existing proof and its limits remain in the PR body. Review only; no repair or merge action is requested.

@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@steipete steipete self-assigned this Sep 18, 2026
Preserve daemon action JSON and human output ownership, including current
backup and rebind receipts, readiness exit codes, and runtime pin contracts.

Related: #150047.
Integrate canonical main e99e75e, including config include publication fix 97e9ce9 and wrapper import-closure fix b518db4. Preserve the published PR ancestry and byte-identical daemon output patch.
Integrate canonical main ca97ceb with SSH pairing fixture fix f87f23c and the reviewed updater owner changes from #153764. Preserve the published PR ancestry and byte-identical daemon output patch.
@steipete
steipete merged commit 05a0b7b into main Sep 22, 2026
195 checks passed
@steipete
steipete deleted the codex/daemon-output-owner-20260914 branch September 22, 2026 11:11
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 23, 2026
* refactor(cli): centralize daemon action output

Keep generic result emission JSON-only and route message-bearing successes
through the action context. Bind install warnings once in the shared install
context while preserving warning order and lifecycle exception boundaries.

Characterize human and JSON output through the existing response owners,
including foreground restart health ordering and install warning behavior.

* test(daemon): isolate install warning inventory

* chore: merge main into daemon output cleanup

* chore: merge main into daemon output cleanup

Preserve daemon action JSON and human output ownership, including current
backup and rebind receipts, readiness exit codes, and runtime pin contracts.

Related: openclaw#150047.

* test(cli): update daemon restart output fixture

* chore(cli): integrate current main for daemon output validation

* chore: merge main config reload and wrapper repairs

Integrate canonical main 2a74f33, including config include publication fix fda6f32 and wrapper import-closure fix 91a6617. Preserve the published PR ancestry and byte-identical daemon output patch.

* chore: merge main pairing fixture repair

Integrate canonical main 860100a with SSH pairing fixture fix fadc546 and the reviewed updater owner changes from openclaw#153764. Preserve the published PR ancestry and byte-identical daemon output patch.

Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes 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: 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