Repository navigation
fix(cli): keep zsh subcommand descriptions literal - #135114
Conversation
Reuse the canonical description encoder for the double-quoted zsh arguments specification while retaining its single-quote layer. Remove the duplicate escaping path and cover built-in, root, and nested commands through real zsh parsing. Fixes #135089 Related: #76126, #64490 Co-authored-by: walker <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 1, 2026, 6:38 AM ET / 10:38 UTC. ClawSweeper reviewWhat this changesThe PR reuses the existing zsh double-quoted description encoder for subcommand completion entries and adds real zsh parsing coverage for built-in, root, and nested commands. Merge readinessKeep this protected maintainer PR open: it supplies a focused, unique repair for a defect still present on fetched current main, and no introduced correctness or security defect was found. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s CLI completion generator turns Commander command metadata into shell scripts. The zsh script passes command names and descriptions through flowchart LR
A[CLI command metadata] --> B[Completion generator]
B --> C[Zsh completion script]
C --> D[_arguments specification]
D --> E[_values command menu]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -5, Tests +68. Total +63 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Merge the canonical encoder reuse after normal exact-head merge gates complete, preserving the new zsh parsing regression test as the owner-boundary guard. Do we have a high-confidence way to reproduce the issue? Yes—source-reproducible with high confidence: fetched main leaves dollar signs and backticks unescaped in a double-quoted zsh subcommand specification, and the supplied zsh scenario exercises that exact path. Is this the best way to solve the issue? Yes—the existing double-quoted description encoder is the narrowest maintainable solution because zsh option descriptions already use it and the PR retains the subcommand-specific single-quote layer. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1dc3d5f2e790. LabelsLabel changes:
Label 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
|
|
Ready to land at Three maintained regressions failed before and passed after. Actual interactive Exact-head CI has completed successfully. A fresh independent managed P0–P2 review of the complete commit found no actionable findings. The latest ClawSweeper review found no correctness/security defect; its rank-up request to finish the checks is satisfied. Native |
|
Merged via squash.
|
Reuse the canonical description encoder for the double-quoted zsh arguments specification while retaining its single-quote layer. Remove the duplicate escaping path and cover built-in, root, and nested commands through real zsh parsing. Fixes openclaw#135089 Related: openclaw#76126, openclaw#64490 Co-authored-by: walker <[email protected]>
Closes #135089. Related: #76126 and #64490.
What Problem This Solves
Fixes an issue where users pressing Tab in zsh would execute command examples embedded in subcommand descriptions. For
openclaw models auth, the built-in logout hint loses its literalmodels auth listtext during completion.Why This Change Was Made
Subcommand descriptions duplicated incomplete escaping inside a double-quoted
_argumentsspecification. Reuse the existing option-description encoder and retain the separate single-quote layer. This removes the duplicate path without adding a helper, dependency, or configuration option.Production: +1/−6, net −5 lines. Tests: +68 lines. Thanks to @walker1211 for the subcommand report in #76126; the merged #64490 addressed the option-description sibling. Introduction provenance is unknown.
User Impact
Newly generated zsh completions preserve literal command descriptions and aliases, including quotes, dollar signs, and backticks. Other shell generators and completion installation behavior are unchanged.
Evidence
zsh -fproof uses the actualregisterModelsCli/getCompletionScriptoutput and normalcompinit -D,_arguments, and_values. Before: Tab invokes a harmless recordingmodelsfunction once and displaysRemove a saved auth profile (see for ids). After: no invocation, and the complete literal description is retained. The typed command was never submitted; no auth action, full built CLI, profile change, or installation was performed.Focused reproduction command:
node scripts/run-vitest.mjs src/cli/completion-cli.test.ts \ -t 'command descriptions literal through real zsh parsing'Environment: macOS 27.0 arm64, Node 24.20.0, pnpm 12.1.0, zsh 5.9.2.