Skip to content

fix(completion): escape terminal controls in installation messages - #184120

Merged
steipete merged 1 commit into
openclaw:mainfrom
Alix-007:alix/terminal-completion-20261026
Oct 26, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
Alix-007:alix/terminal-completion-20261026

Conversation

@Alix-007

@Alix-007 Alix-007 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes terminal actions and forged status lines when completion installation displays a profile path containing control characters.

User Impact

Install and reinstall messages display safe paths. If a reload hint contains terminal controls, the installer asks the user to restart the shell. Ordinary reload commands and literal profile/cache paths remain intact.

Why This Change Was Made

Use the existing terminal display policy at the installation-message owner, without changing path resolution, shell quoting, or atomic profile publication. Thanks to @Alix-007 for the fix and regression coverage.

Evidence

  • node scripts/run-vitest.mjs src/cli/completion-runtime.test.ts --maxWorkers=1: on unchanged main, the new regression fails at the unsafe reload-message assertion and the other 29 tests pass (6.62s wrapper wall time). With the patch, all 30 tests pass (7.52s).
  • The regression installs and reinstalls into the actual control-containing profile path, checks byte-identical reinstall, and verifies terminal-safe messages. The same file exercises real Bash/Zsh profile loading on this Mac.
  • Targeted oxlint, oxfmt, and git diff --check pass. The completion CLI consumer suite also passes all 13 tests (17.24s wrapper wall time).
  • Contributor's Linux normal-build CLI proof at 2eafd302cf4c026c6c43df957da197b26c2d39f3 covers Bash/Zsh install/reinstall, safe output, literal profile writes and successful Bash completion registration.
  • Fresh standalone CLI replay was not completed here because the lane's pnpm openclaw runtime-publication guard could not verify an offline Gateway. No running Gateway or operator state changed.
  • Production: +13/-4 lines (net +9); tests: +34/-0. The existing sanitizer and control detector cover three path messages plus one unsafe reload hint; no new formatter or state owner.
  • Independent Codex review: no actionable P0–P2 findings. Exact-head CI watcher: GREEN, run 40260861181. Local merge-tree is clean against refreshed main.

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: S labels Oct 26, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR sanitizes profile paths in installation messages and replaces control-containing reload hints with a shell-restart instruction.

Example: Install Zsh completion with ZDOTDIR containing the literal characters /tmp/profiles followed by a newline and operator-forged.

  • Before: Installation messages print an extra status-like line and include the newline in the reload command.
  • After: Messages display the newline as \n and recommend restarting the shell, while installation still uses the literal directory.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused, useful repair with retained shipped-CLI proof, meaningful regression coverage, successful exact-head gates, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Retained proof at the unchanged head covers normally built Linux CLI Bash/Zsh installation and reinstall, safe terminal output, literal profile writes, and Bash completion registration; the earlier review documents inspection of those traces, and the current body preserves their scenario and result.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A shell profile path containing terminal controls can alter terminal state or forge installation status lines.
Reason: The patch repairs unsafe display behavior using existing policy without adding configuration, restrictions, or a competing owner.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current completion-output defect with a focused change; no actionable introduced bugs were found.

Priority: P2
Reviewed head: 2eafd302cf4c026c6c43df957da197b26c2d39f3

Before merge

None.

Findings

None.

Agent review details

How this fits together

The completion installer resolves shell profiles, installs a cached-script hook through the atomic file publisher, and emits installation guidance.

flowchart LR
  A[Completion CLI] --> B[Completion installer]
  C[Shell environment] --> B
  B --> D[Atomic profile publisher]
  B --> E[Terminal text policy]
  E --> F[Installation messages]
Loading

Technical review

Best possible solution:

Merge the focused display-boundary repair while preserving literal paths, shell quoting, and atomic profile writes.

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

Current-main source directly exposes control-containing profile paths to the terminal, and the recorded baseline regression fails at the unsafe reload message; no target code was run during this read-only review.

Is this the best way to solve the issue?

This is the smallest complete repair for the stated installation-message defect: reuse the established terminal policy at the output owner and avoid printing an altered, unusable reload command.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 927d0ebb1de9.

Provenance checked

  • Installation status messages keeps the original intent (0e54440: The cycle-removal extraction carried existing human-readable installation messages into completion-runtime.ts; original introduction remains unknown because local pickaxe encountered unavailable historical blobs.)
  • Reload guidance changes intended behavior with a stated reason (fix(cli): honor shell-owned completion profile locations #117002: Canonical profile hints and shell-specific quoting make reload instructions address the profile the shell actually reads; the new fallback avoids printing terminal controls while retaining ordinary commands.)
  • Missing-profile notice keeps the original intent (fix(cli): preserve shell profiles when completion install fails #117987: Atomic publication preserves existing profiles on failure and creates missing profiles safely; sanitizing the notice leaves publication behavior intact.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit d720d78 adds src/cli/completion-runtime.ts:466 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d720d78fee11; files: src/cli/completion-runtime.ts)
  • Vincent Koc: Raw commit 0e54440 adds src/cli/completion-runtime.ts:249 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 0e54440ecc39; files: src/cli/completion-runtime.ts)

PR surface

Source +9, Tests +34, Docs +2. Total +45 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 13 4 +9
Tests 1 34 0 +34
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 49 4 +45

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Control-containing profile paths can manipulate installation output, but the trigger is narrow and ordinary completion operation remains available.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-26T03:03:35.839Z sha 2eafd30 :: needs maintainer review before merge. :: none

Reviewed October 26, 2026, 3:09 AM ET / 07:09 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 26, 2026
@steipete
steipete merged commit c27715f into openclaw:main Oct 26, 2026
153 of 155 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
…penclaw#184120)

Sanitize completion installation status paths and suppress unsafe shell reload hints while preserving literal profile writes and ordinary shell commands.

Validation: the regression fails on base and all 30 runtime tests plus 13 CLI consumer tests pass on the reviewed head. Targeted lint/format and exact-head CI pass.

Co-authored-by: Alix-007 <[email protected]>
@Alix-007

Copy link
Copy Markdown
Contributor Author

Thanks @steipete for merging this! Appreciate your time.

RomneyDa added a commit that referenced this pull request Oct 28, 2026
…184120)

Sanitize completion installation status paths and suppress unsafe shell reload hints while preserving literal profile writes and ordinary shell commands.

Validation: the regression fails on base and all 30 runtime tests plus 13 CLI consumer tests pass on the reviewed head. Targeted lint/format and exact-head CI pass.

Co-authored-by: Alix-007 <[email protected]>

(cherry picked from commit c27715f)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit cc54b653a67c76c9c2c9c487cfcb881fc66a01e6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

2 participants