Repository navigation
fix(cli): bound unknown command diagnostics - #120380
Conversation
|
Codex review: found issues before merge. Reviewed August 7, 2026, 11:47 PM ET / August 8, 2026, 03:47 UTC. ClawSweeper reviewWhat this changesThis PR sanitizes and bounds unknown root-command diagnostics while preserving typo suggestions for ordinary command mistakes. Merge readinessThis focused CLI hardening fix is still needed, but the exact head preserves the prior P2 boundary error: a truncated label can reach 129 UTF-16 units despite its 128-unit cap. The maintainer-authored, protected PR should remain open for that mechanical correction and CI completion. Priority: P2 Review scores
Verification
How this fits togetherBefore fully loading command metadata, the CLI checks whether the first argv token is owned by a built-in command or plugin. Unknown roots use a shared formatter to produce a terminal error, which this PR makes safe and bounded. flowchart LR
A[CLI argv token] --> B[Root command ownership check]
B -->|Known command| C[Command routing]
B -->|Unknown root| D[Shared diagnostic formatter]
D --> E[Terminal-safe bounded label]
E --> F[CLI error output]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +9, Tests +34. Total +43 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Reserve the ellipsis unit within the display limit, assert the final rendered label is at most 128 UTF-16 units, then merge after exact-head required checks are green. Do we have a high-confidence way to reproduce the issue? Yes—source inspection shows a 1,000-emoji unknown command reaches the overflow branch, retains 128 UTF-16 units, and then appends a further one-unit marker. Is this the best way to solve the issue? No—the formatter is the correct owner boundary, but it must reserve marker space before truncation; the existing test currently encodes the incorrect 129-unit result. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8b8058a68b6a. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
1755c4e to
b4b72f9
Compare
a66a765 to
f249399
Compare
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Land-ready proof for exact head
Recommendation: merge after the queued exact-head ClawSweeper re-review clears the prior cap finding or records a publisher-only gap. |
|
Merged via squash.
|
* fix(cli): bound unknown command diagnostics * fix(cli): include truncation marker in display cap
Summary
Fixes #120379
Root cause
The early unowned-command diagnostic interpolated the raw argv token twice. Control sequences and embedded line breaks therefore reached stderr unchanged, while oversized tokens amplified the error output.
Verification
node scripts/run-vitest.mjs run src/cli/run-main.exit.test.ts— 207 passedpnpm build— passed twice, including the packaged CLI and Control UI bundle\n/\t; 1,000 emoji produced a bounded 776-byte diagnostic whose displayed label is 127 UTF-16 units including the ellipsisnode scripts/check-changed.mjs -- src/cli/run-main.ts src/cli/run-main.exit.test.ts— passed on Blacksmith Testboxtbx_01kzf8ab10337p41ms530ex4cb: https://github.com/openclaw/openclaw/actions/runs/31226710750Risk
Low. The change is limited to display formatting for unknown command roots. Command routing, plugin ownership, config, protocol, storage, dependencies, and normal command execution are unchanged.