Repository navigation
CLI: escape zsh completion descriptions - #64490
Conversation
Greptile SummaryThis PR adds One escaping rule in the new function is incorrect: Confidence Score: 5/5Safe to merge; the primary fix is correct and the single-quote escaping edge case only affects completion description display. All remaining findings are P2: the incorrect src/cli/completion-cli.ts — Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/cli/completion-cli.ts
Line: 209
Comment:
**Incorrect `'` escape for double-quoted context**
`'\''` is the idiom for embedding a literal single quote inside a *single-quoted* shell string. Inside a *double-quoted* zsh string — which is exactly what `generateZshArgs` emits (e.g. `"--flag[${desc}]"`) — a `'` is already literal and needs no escaping. The `'\''` sequence therefore writes the extra characters `\`, `'`, `'` verbatim into the description.
For an option description like `"don't retry"`, the generated spec becomes `"--flag[don'\''t retry]"`, which zsh displays as `don'\''t retry` instead of `don't retry`. By contrast, `generateZshSubcmdList` correctly uses `'\''` because it wraps its values in *single* quotes.
```suggestion
.replace(/\$/g, "\\$")
.replace(/`/g, "\\`")
.replace(/\[/g, "\\[")
.replace(/\]/g, "\\]");
```
Drop the `'` replacement; a single quote inside a zsh double-quoted string requires no escaping.
How can I resolve this? If you propose a fix, please make it concise.Reviews (1): Last reviewed commit: "CLI: escape zsh completion descriptions" | Re-trigger Greptile |
This comment was marked as spam.
This comment was marked as spam.
|
Thank you for the feedback. This PR is limited to updating zsh completion escaping in The current failing tests appear to be related to schema/help snapshot mismatches under Please let me know if you would like me to investigate this further or adjust anything on my side. |
|
Codex review: needs maintainer review before merge. Reviewed June 22, 2026, 10:00 PM ET / 02:00 UTC. Summary PR surface: Source +5, Tests +19. Total +24 across 2 files. Reproducibility: yes. Source inspection shows current main and v2026.6.9 leave dollar signs and backticks unescaped in double-quoted zsh option specs, and the attached terminal screenshots show the before/after completion behavior. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this focused zsh option-description escaping fix after required checks and proof automation are green or consciously refreshed, keeping adjacent zsh autoload and positional-completion work separate. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main and v2026.6.9 leave dollar signs and backticks unescaped in double-quoted zsh option specs, and the attached terminal screenshots show the before/after completion behavior. Is this the best way to solve the issue? Yes. Escaping at generateZshArgs is the narrowest maintainable fix because option descriptions enter the double-quoted zsh _arguments context there; subcommand descriptions and other shells use separate quoting paths. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 1252378018f8. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +5, Tests +19. Total +24 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
Thanks for catching that. The PR body was stale and still described the earlier I've updated it to reflect the current diff, which focuses on escaping |
|
The CI is failing with Could you advise on whether this is a known issue or if there's anything I |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

What Problem This Solves
Zsh completion descriptions are emitted inside double-quoted
_argumentsspecs, but$and backticks were not escaped. Descriptions such as$OPENCLAW_STATE_DIR/completionsor examples wrapped in backticks can be interpreted by zsh instead of being displayed literally.This can break or corrupt CLI tab-completion output and degrades the developer experience.
Why This Change Was Made
This PR keeps the scope limited to zsh option-description escaping. The branch was repaired in place by ProjectClownfish while preserving @EdenKangdw’s original contributor PR and branch history.
The repair keeps the useful
$and backtick escaping, avoids single-quote escaping that does not apply to this double-quoted zsh context, and adds focused regression coverage.User Impact
Generated zsh completions display CLI option descriptions with
$, backticks, and single quotes literally instead of evaluating or corrupting the description text.Evidence
pnpm test src/cli/completion-cli.test.tsandpnpm check:changed.5543a13e1b4ce4a8e4259d8a1668473bd1cdac12.Change Type
Scope
Compatibility