Skip to content

refactor(cli): fold single-consumer command helpers - #176903

Merged
steipete merged 1 commit into
mainfrom
deslop/z25-32-cli-owners-20261015
Oct 19, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/z25-32-cli-owners-20261015

Conversation

@steipete

@steipete steipete commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

CLI registration, daemon lifecycle and skills-library commands forward their own inputs through private modules with one production consumer. Direct helper tests keep those implementation surfaces exported.

User Impact

No user-visible change; flags, output, plugin lifecycle, authorization and file admission remain unchanged.

Why This Change Was Made

Keep gateway lock replacement in external restart health, start-readiness verification in the lifecycle command, message helpers/thread registration in the message registration owner, and skills-library input/upload preparation in the library CLI. Remove the retired modules and move their retained tests through the registered production commands. Matrix and Teams integration cases invoke real Commander handlers and the real message command with their existing HTTP fixtures.

This is a CLI-area slice of the wide single-consumer family under campaign rule 11. Public flags, output, contracts and lazy imports are unchanged. Phase E is untouched.

Related: #176771, #176810 (earlier area slices of the same wide family).

Best-effort tradeoffs accepted

  • No security, authority, durability, shutdown settlement, readiness deadline, retry or resource guard was removed. This cut removes private module/API and argument-projection indirection, not features.
  • Restart health keeps previous-owner release and replacement identity checks. Start readiness keeps process-scope cancellation and both HTTP probes.
  • Message dispatch keeps numeric validation, secret scope, plugin lifecycle settlement, exit status and output-drain ordering.
  • Skills imports keep actual-byte file/bundle limits, strict UTF-8, binary file preservation, executable bits and all upload acknowledgements.

Net LOC

89 net production lines removed across 9 production paths; 28 total paths, including test/support and shrink-only inventory entries, which are excluded from production LOC. This final measured count supersedes the earlier draft estimate of 91. The moved action-kind cast is replaced by selecting the exact action from the existing typed list; its orphan allowance is deleted rather than moved or expanded.

Evidence

Complete source/test migration inspection and smallest-complete-cut pass completed. Formatting and whitespace checks passed. Frozen/prefer-offline dependency setup completed in 14 seconds without a tracked generated-file, manifest or lockfile change. Fresh independent P0–P2 review of the final candidate completed scoped-clean, including final source verification.

Fourteen owner/consumer files produced 256 unique passing cases, two existing completion-shell skips and two thread-suite failures caused by cold lazy imports spending compilation inside case deadlines. The same four fixture consumers passed after moving the same already-mocked I/O imports to collection: 45 cases passed, including all six thread cases; two existing shell skips unchanged. This is 258 unique passing cases across those runs, not their summed replay count. Original serial wall time was 1,205.75 seconds; the focused four-consumer replay took 1,049.28 seconds including a cold worker-cache preparation.

The selected 8 MiB piped-output subprocess exposed an orphan worker-compiler boundary still keyed to the deleted helper path (137.79 seconds, failed JSON parse). Both exact matcher references now name the registration owner, preserving the same command-module substitution. Its unchanged replay passed: complete piped JSON and exit 1, 25.151 seconds test time / 390.79 seconds Vitest wall time including cold worker preparation; wrapper completed successfully in 456.95 seconds. The other 25 cases were excluded by the explicit test-name selection, not new skips.

Final owner replay passed all 67 message/readiness cases, plus all 14 suppression cases: 341.12 seconds serial wrapper wall time, including 216.65 seconds for the owner shard and 59.57 seconds for tooling. Targeted native types across fourteen owner/consumer test roots and normal type-aware lint across nineteen core/test/support targets plus two tooling targets passed without diagnostics. Both required cycle checks passed with zero cycles. Changed-check planning completed in dry-run mode; broad gates are delegated to exact-head CI. No timeout, assertion, bound, mock breadth or expected result changed for the compiler repair.

The two root integration consumers additionally passed normal type-aware lint with their matching root-test configuration, with no diagnostics.

Exact-head CI run 39198781357 passed. Its 97 check-run rows contain 70 successes and 27 planner skips, totaling 9,786 summed check-run seconds (parallel durations, not an A/B cost estimate). No local broad suite, build, E2E, whole-graph typecheck, operator-state access, timeout increase, retry, new test skip, suppression or expanded allowance is claimed.

@clawsweeper

clawsweeper Bot commented Oct 19, 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 cli CLI command changes scripts Repository scripts size: XL labels Oct 19, 2026
@steipete
steipete marked this pull request as ready for review October 19, 2026 04:18
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T04:20:59.844449Z baf4d73 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR folds private CLI helpers into their existing command owners and migrates tests to those command boundaries.

Example: Run openclaw message read --channel discord --target channel:123 --limit 20.

  • Before: Registration delegates validation, dispatch, and exit handling through a separate helper module.
  • After: The registration owner performs the same operations with unchanged flags and behavior.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A coherent, source-verified refactor with green exact-head CI and command-boundary coverage; supplied validation remains harness-based.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied evidence covers registered command handlers, HTTP-fixture consumers, readiness cases, and a subprocess output-drain test without claiming live product execution.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-authored direction removes private single-consumer interfaces and test-only exports while preserving public behavior.

Merge readiness

✅ Ready for maintainer review

This PR is a useful, maintainer-directed consolidation; no actionable correctness or security defects were found, and exact-head CI passed.

Priority: P3
Reviewed head: baf4d73dfeeb71ca9b5c00b853dc7e63fcf93894

Before merge

None.

Findings

None.

Agent review details

How this fits together

CLI registration accepts parsed command options, invokes Gateway lifecycle, messaging, or skills-library operations, and produces command output and exit status.

flowchart TD
  A[CLI arguments] --> B[Command registration]
  B --> C[Gateway lifecycle]
  B --> D[Message dispatch]
  B --> E[Skills library RPC]
  C --> F[Output and exit status]
  D --> F
  E --> F
Loading

Technical review

Best possible solution:

Keep the consolidated implementations with their existing command owners while preserving the migrated behavioral contracts.

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

No runtime defect is claimed; source comparison verifies the consolidation, and no target code was executed during this read-only review.

Is this the best way to solve the issue?

The change uses existing owners, deletes the superseded modules, and retains distinct command, readiness, cleanup, and file-admission coverage without adding production machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2fc8899e8b52.

Provenance checked

  • Message execution and cleanup keeps the original intent (7d98ab8: Run shutdown hooks against the exact command-owned plugin registry, including failure unwinding.)
  • Thread command registration keeps the original intent (dc7fe2a: Consolidate CLI registration plumbing while preserving command options and channel-specific action mapping.)
  • Managed-start readiness keeps the original intent (ce5e33c: Distinguish a still-starting Gateway from failure while retaining bounded process-scoped health verification.)
  • External restart lock replacement keeps the original intent (266d3c8: Verify previous-owner release and replacement identity for externally supervised restarts.)
  • Skills-library file admission keeps the original intent (91cecc2: Enforce file and bundle limits against actual bytes and reject replaced inputs before upload.)
  • Compiled broadcast fixture keeps the original intent (12bc123: Preserve exact native message-command substitution for the subprocess output-drain fixture.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5469328 adds src/cli/daemon-cli/lifecycle.ts:600 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5469328b6c31; files: src/cli/daemon-cli/lifecycle.ts)
  • Galin Iliev: Raw commit 14e26a3 adds src/cli/daemon-cli/restart-health-external.ts:80 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 14e26a380d34; files: src/cli/daemon-cli/restart-health-external.ts)

PR surface

Source -89, Tests +130, Other -6. Total +35 across 28 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 9 474 563 -89
Tests 15 502 372 +130
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 4 2 8 -6
Total 28 978 943 +35

Review metrics

Metric Value Why it matters
Production versus test/support LOC Production +474/-563; tests/support +502/-372 Production removes 89 net lines; test growth moves retained checks through command registration rather than exported private helpers.

Labels

Label changes:

  • add P3: This is behavior-preserving internal cleanup with no established user-facing defect.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P3: This is behavior-preserving internal cleanup with no established user-facing defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 19, 2026, 12:48 AM ET / 04:48 UTC.

@steipete
steipete merged commit 8643107 into main Oct 19, 2026
252 of 254 checks passed
@steipete
steipete deleted the deslop/z25-32-cli-owners-20261015 branch October 19, 2026 04:56
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

cli CLI command changes P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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