Repository navigation
fix(cli): complete Bash option values without duplicate prefixes - #136557
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed September 2, 2026, 5:10 PM ET / 21:10 UTC. ClawSweeper reviewWhat this changesThe PR rebuilds Bash completion’s logical command words around Merge readinessKeep this maintainer-owned PR open: current main still contains the reported Bash completion behavior, while the prior cursor-span finding is addressed and no new blocking defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe CLI generates a Bash completion script from the Commander command tree. Bash supplies token and cursor metadata to that script, which resolves the active command and returns the text Readline should insert. flowchart LR
A[Typed CLI line] --> B[Bash completion metadata]
B --> C[Generated completion script]
C --> D[Reassembled command words]
D --> E[Command and option lookup]
E --> F[Readline replacement candidates]
Decision needed
Why: Repository policy prevents automated cleanup of MEMBER-authored or Before merge
Agent review detailsSecurityNone. PR surfaceSource -7, Tests +174, Docs +1. Total +168 across 5 files. View PR surface stats
Review metrics
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: Land this focused generator repair once the designated maintainer accepts it and the exact-head merge gates are green. Do we have a high-confidence way to reproduce the issue? Yes. The linked report and PR body provide concrete native Bash 3.2 and 5.3 scenarios, and current main still has the raw-token path that those scenarios exercise. Is this the best way to solve the issue? Yes. Repairing the generated Bash owner at the point where Bash word fragments and Readline’s replacement span are interpreted avoids changing configuration or other shell generators. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5b15291868b9. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…nclaw#136557) * fix(cli): complete Bash option values without duplicate prefixes * fix(cli): preserve Bash completion cursor spans
Normalize Bash completion words and insertion prefixes together so quoted, escaped, and mixed prefixes complete to the supported value without evaluating shell input. Preserve existing word-break and cursor behavior. Related: #136557 (deferred quoted-value completion).
Normalize Bash completion words and insertion prefixes together so quoted, escaped, and mixed prefixes complete to the supported value without evaluating shell input. Preserve existing word-break and cursor behavior. Related: openclaw#136557 (deferred quoted-value completion).
Fixes #136556.
What Problem This Solves
Fixes an issue where users completing Bash options after
=would receive no choices or a duplicated option prefix. A named profile such as--profile=gatewaycould also send completion into the wrong command context.Why This Change Was Made
The generator now reconstructs adjacent equals/colon fragments once and uses those same logical words for command selection and option choices. Returned text respects the fragment Readline actually replaces. Whitespace and shell redirections remain separate. Shared short-option scanning and command-context dispatch replace duplicated paths.
Production +54 / −61 = −7 LOC; tests/support +217 / −43 = +174; docs +1. Generated Bash output is 149,561 bytes versus 144,723 before; this is a correctness repair and source simplification, with no generated-size or speed claim.
User Impact
Both
--flag valueand--flag=valuecomplete correctly across the tested native Bash versions, including named profiles before nested commands. Attached short values continue to work. The unusable-s=fishsuggestion is removed: the real Commander parser treats its value as=fishand already rejects it.Other shell generators emit byte-identical output. No installation, configuration, storage, dependency or global
COMP_WORDBREAKSchange is introduced.Evidence
The original and rebuilt compiled CLI generated scripts inside isolated synthetic state. Real interactive Tab presses exercised those scripts:
completion --shell=--profile=gateway completion --shell ffishcompletion --shell=ffreplacement spanfish, without a duplicate prefixv2026.8.2and unchanged on current main; no unverified introduction attribution is made.Review finding and native cursor proof
The September 2 ClawSweeper P2 finding and its rank-up request are addressed. Reconstructed words retain the complete command-line token; matching now trims that token to the actual cursor before deriving Readline replacement text. Real Tab presses with the cursor after
fin--shell=fishformerly returned an empty candidate on the first candidate; both Bash 3.2 and 5.3 now returnfish. This keeps the existing right-of-cursor suffix under native Readline'sskip-completed-text=offsetting. No shell editing setting is changed.The final 62 native cases preserve the preceding 40 cases and add 22 cursor/UTF-8 controls; all 62 restore the caller's locale. GNU release source confirms the offset unit changes at Bash 4.3:
pcomplete.cin Bash 4.2 binds the byte index directly, while Bash 4.3 converts the prefix throughMB_STRLEN. The generated function uses local byte semantics only for those older versions. A real Bash 3.2 UTF-8 regression failed before that correction and passes afterward. Bash 4.2/4.3 themselves were source-inspected, not executed.The dependency-inspection gap is also closed: root personally inspected Commander 15.0.0
lib/command.js:1760–1907(parseOptions) andlib/option.jschoice validation. Actual parser proof rejects-s=fishbecause the attached short value is literally=fish;-sfishand-ysfishremain covered.The final canonical runtime build, all 29 required changed-file checks, and one cumulative independent Codex review through P2 pass with frozen inputs. Bash 3.2 lacks
READLINE_LINE, so its evidence is the real callback plus PTY transcript. Quoted enum completion such as--shell="fish"with the cursor inside the quotes remains a named pre-existing follow-up; no repair of that separate behavior is claimed.Final review disposition
The latest ClawSweeper review reports no actionable defect. Its remaining Commander source-inspection gap is resolved by the direct installed-source and actual parser checks above. Its maintainer decision is covered by the explicit request to land this repair. Required exact-head CI is green.