Skip to content

refactor(cli): simplify message result rendering - #131980

Merged
steipete merged 2 commits into
mainfrom
codex/cleanup-message-rendering-0313
Aug 28, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/cleanup-message-rendering-0313

Conversation

@steipete

@steipete steipete commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The message CLI's human-readable formatter wraps individual table strings in arrays, then immediately unwraps them at its call sites. Message reads and pinned-message lists also repeat the same payload extraction, table rendering, and pagination flow. This is a bounded, maintainer-requested, AI-assisted internal cleanup.

Why This Change Was Made

Return one string from each private single-table renderer, remove the two one-use payload adapters, and keep read/pins rendering in one local flow. The public formatter still returns the same list of output lines. Repeated pagination-hint returns share their existing short-circuit condition.

Production changes are +56/-100, net -44 lines in one file. The assertion-safety baseline also tightens this file's count from 21 to 20 because the duplicate adapter casts disappear. No replacement abstraction or new export is introduced.

User Impact

No intended behavior change. Preserve empty output lines, empty-result messages, null versus empty-string handling, table formatting, limits, pagination precedence, reaction evaluation order, and existing send/poll/failure output. CLI flags, parsing, exit status, JSON output, plugin APIs, configuration, and persistence are untouched.

Evidence

  • OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/commands/message-format.test.ts src/commands/message.test.ts: 51 tests passed across two existing suites.
  • Actual before/after formatter comparison against base 0313c2dbc4234df6801626c6441a731dc5de5a19: 356 fixtures across four terminal widths, seven limits, and plain/colored output produced 19,936 matching cases. Public output bytes, thrown error names/messages, and payload-read order matched. The probe imported the real formatter dependencies and used an isolated fixture channel registry, without contacting channel services.
  • Scoped oxfmt --check, core oxlint, and git diff --check passed.
  • Initial CI correctly caught the stale assertion budget (20 < 21). The owned baseline entry is now 20; the full assertion-safety guard against the frozen base passes. No guard was weakened or unrelated baseline entry pruned.
  • Isolated precommit Codex review of the complete two-file change, independent owner/caller review, and a distinct read-only review of exact commit 7ad4711bb1cee4a6e0dcea246fc95f9aa3773541 found no actionable issues.
  • No test files changed. Existing formatter and message-command tests are retained.

@clawsweeper

clawsweeper Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 28, 2026 17:40
@steipete steipete self-assigned this Aug 28, 2026
@openclaw-barnacle openclaw-barnacle Bot added commands Command implementations size: S maintainer Maintainer-authored PR labels Aug 28, 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 Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 2:06 PM ET / 18:06 UTC.

ClawSweeper review

What this changes

The PR removes array wrappers from private CLI message-result table renderers and combines the duplicated read and pinned-message formatting paths without changing the public string[] formatter output.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No introduced regression was found: the private helpers now return their sole string directly while the public formatter still returns terminal lines. Keep this maintainer-authored, maintainer-labeled PR open for the normal exact-head CI and review gate.

Priority: P3
Reviewed head: 7ad4711bb1cee4a6e0dcea246fc95f9aa3773541

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative refactor with no actionable source finding; exact-head CI remains the normal landing gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-authored behavior-neutral terminal formatter refactor is outside the external-contributor proof gate; the supplied body also records a real before/after formatter comparison, while existing tests cover the changed paths.
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 behavior-neutral terminal formatter refactor is outside the external-contributor proof gate; the supplied body also records a real before/after formatter comparison, while existing tests cover the changed paths.
Evidence reviewed 6 items Introduced rendering boundary: Private renderers now return one string, which their call sites append to the unchanged public list of terminal lines; the read/pin path remains gated on an array payload.
Caller and JSON boundary: The command emits JSON before dynamically importing the text formatter; the non-JSON caller iterates every returned line.
Existing behavioral coverage: Existing tests cover read, pins, searches, reactions, empty searches, limits, and the three pagination signals; none are changed by this refactor.
Findings None None.
Security None None.

How this fits together

The openclaw message command runs a channel operation and gives its result to a shared formatter for human-readable terminal output. JSON output is emitted earlier on a separate path, while reads, pins, searches, and reactions receive tables and pagination hints.

flowchart LR
  A[Message CLI command] --> B[Channel operation result]
  B --> C[CLI result formatter]
  C --> D{Action type}
  D --> E[Read pins search reactions]
  D --> F[Generic summary]
  E --> G[Terminal lines]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Exact-head required checks are still queued or running; landing should wait for successful completion and confirmation that the latest ClawSweeper comment has no unaddressed rank-up move.
Agent review details

Security

None.

PR surface

Source -44, Other 0. Total -44 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 56 100 -44
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 1 0
Total 2 57 101 -44

Review metrics

Metric Value Why it matters
Production LOC delta production −44, tests 0 The change removes two one-use adapters and array wrappers without growing the public formatter surface.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the compact private-helper refactor after exact-head CI is green and the current ClawSweeper review note has been checked for outstanding rank-up moves.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the compact private-helper refactor after exact-head CI is green and the current ClawSweeper review note has been checked for outstanding rank-up moves.

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

Not applicable: this is an internal refactor, and source comparison shows that the observable terminal-line paths remain equivalent.

Is this the best way to solve the issue?

Yes: returning direct strings from private single-table renderers removes redundant adapters while preserving the public list-of-lines contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a behavior-preserving internal CLI cleanup with no reported user-impact regression.
  • 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 behavior-neutral terminal formatter refactor is outside the external-contributor proof gate; the supplied body also records a real before/after formatter comparison, while existing tests cover the changed paths.

Evidence

What I checked:

  • Introduced rendering boundary: Private renderers now return one string, which their call sites append to the unchanged public list of terminal lines; the read/pin path remains gated on an array payload. (src/commands/message-format.ts:46, 7ad4711bb1ce)
  • Caller and JSON boundary: The command emits JSON before dynamically importing the text formatter; the non-JSON caller iterates every returned line. (src/commands/message.ts:170, 7ad4711bb1ce)
  • Existing behavioral coverage: Existing tests cover read, pins, searches, reactions, empty searches, limits, and the three pagination signals; none are changed by this refactor. (src/commands/message-format.test.ts:58, 7ad4711bb1ce)
  • Current-main comparison: Current main still contains the prior wrapper helpers and separate read/pin branches, so the requested cleanup is not already implemented there. (src/commands/message-format.ts:46, e11c566824b1)
  • History and ownership: Recent merged history includes fixes for failed action reporting and reaction limits by the same area contributor; blame attributes the new formatter and action-flow lines to this PR’s first commit. (src/commands/message-format.ts:389, 061ac829b864)
  • Review-context limitation: The local GitHub archive tool is unavailable and live GitHub reads could not connect, so the two omitted bot comments and their latest rank-up moves could not be independently read. This is a reviewer limitation, not missing contributor proof.

Likely related people:

  • steipete: Recent merged CLI message-format fixes and the current refactor are authored by Peter Steinberger. (role: recent formatter contributor; confidence: high; commits: 061ac829b864, 2f20142d69f0, 239edf12b68c; files: src/commands/message-format.ts)
  • wm0018: The existing history identifies this contributor for threading --limit and provider pagination through the CLI formatter. (role: pagination-path contributor; confidence: medium; commits: 4029f1c07e7a; files: src/commands/message-format.ts, src/commands/message.ts)

Rank-up moves

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

  • Wait for exact-head required checks, then check the latest ClawSweeper comment for any rank-up moves before landing.

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 (1 earlier review cycle)
  • reviewed 2026-08-28T17:46:30.637Z sha 239edf1 :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Ready to land after exact-head verification of 7ad4711bb1cee4a6e0dcea246fc95f9aa3773541.

The cleanup removes private single-string array wrappers and merges duplicate read/pins rendering while preserving the public string[] result, blank lines, null handling, evaluation order, pagination, and JSON bypass. Production is +56/-100, net -44 lines; tests are unchanged. The assertion baseline tightens one owned entry from 21 to 20.

The two existing formatter/command suites passed 51 tests. A separate actual before/after module comparison passed 19,936 cases across widths, limits, color modes, action families, empty results, errors, and payload-read order. Scoped formatting/lint and the full assertion guard passed. The initial CI failure correctly caught the stale assertion budget; the correction changed no production bytes and did not weaken the guard. Complete-change precommit review and distinct independent exact-head review found no actionable issues.

CI and Workflow Sanity both completed successfully on the final head. The latest ClawSweeper review covers that head with no source findings. Its rank-up request to read the latest review and complete exact-head checks is satisfied; no rank-up was skipped.

@steipete
steipete merged commit fa57231 into main Aug 28, 2026
170 of 172 checks passed
@steipete
steipete deleted the codex/cleanup-message-rendering-0313 branch August 28, 2026 18:24
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
* refactor(cli): simplify message result rendering

* chore(cli): tighten message formatter assertion budget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations 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