Skip to content

fix(cli): prevent descriptor controls in skill and hook reports - #172872

Merged
obviyus merged 5 commits into
openclaw:mainfrom
Alix-007:fix/alix-descriptor-terminal-text-20261015
Oct 22, 2026
Merged

obviyus merged 5 commits into
openclaw:mainfrom
Alix-007:fix/alix-descriptor-terminal-text-20261015

Conversation

@Alix-007

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

Copy link
Copy Markdown
Contributor

What Problem This Solves

Installed skill and hook descriptor strings can inject terminal controls into human list, info, and check reports. Descriptions, emoji, and missing requirements can clear the screen or open an OSC 8 hyperlink instead of remaining display text.

Changes

Neutralize untrusted values before trusted styling, using the existing terminal-core single-line sanitizer. Share the existing whitespace-preserving skill descriptor sanitizer with hook rendering rather than introducing another ANSI parser. Keep descriptor/report objects and the existing JSON paths unchanged.

Thanks to @Alix-007 for the repair and regressions; their commits are retained. Current main's inline skill-name rendering is preserved instead of restoring a removed helper.

Evidence

Built main 722ad802bc2801eadd83c8b484cd9715480b1f97 and candidate independently in isolated Node 24.22.1 Linux Docker. Created an agent/workspace through agents add; installed valid external skill directories through skills install, and external hook descriptors through plugins install --link --force. No internal report objects or databases were seeded. Descriptor metadata contains escaped OSC/CSI/C1 values which the real loaders decode into actual terminal-control characters.

Captured raw stdout/stderr bytes from the built shipped CLI, initially with trusted color disabled:

Human report Main controls Candidate controls
skills list --verbose, twice 18 each time 0 each time
skills info 24 0
skills check 12 0
hooks list --verbose, twice 18 each time 0 each time
hooks info 30 0
hooks check 12 0

The sequences include real ESC clear-screen, OSC 8/BEL links, and C1 controls—not literal backslash output. Readable names/markers remain. With trusted color forced on, candidate info reports retain exactly the same 50 skill / 30 hook SGR styling sequences, while removing the hostile OSC/clear-screen/C1 controls.

All six decoded JSON reports are equal across arms after normalizing only task-root paths. This preserves the preexisting distinction: skill JSON already normalizes terminal controls, while hook JSON retains original descriptor values. Normal Unicode/emoji clean-info controls are unchanged after task root/profile normalization; ordinary hook-description line breaks/tabs and JSON description whitespace are preserved. Independent input-file readback confirms descriptor bytes were never changed.

All 35 focused discovery/formatter/hook tests pass; changed-file formatting and lint pass.

The change reuses existing presentation owners and keeps diagnostic construction raw until the human-output boundary. Redundant sanitation and per-entry sanitizer arrays in compact hook output are removed. Whole PR production +69/-49 (net +20, 118 changed lines), tests +134/-1, plus documentation. There is no shim, SDK, schema, configuration, permission, or authorization change.

Merge danger: two-way presentation change, no state migration. Blast radius is human skill/hook reporting and descriptor-bearing human errors; existing JSON data/shapes and trusted styling retain their behavior.

@clawsweeper

clawsweeper Bot commented Oct 15, 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 cli CLI command changes size: M labels Oct 15, 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 15, 2026
@clawsweeper

clawsweeper Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR sanitizes skill and hook metadata before human-readable CLI rendering while preserving existing JSON behavior.

Example: An installed hook description contains "Readable\u001b[2J description", and the user runs openclaw hooks info terminal-fixture.

  • Before: The CLI emits the clear-screen sequence into the terminal.
  • After: The CLI displays "Readable description" without executing the embedded control.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused repair with shipped-entry-point before/after evidence, preserved data contracts, and the previous blocker resolved; current-head CI is still running.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The body and collaborator comments document built shipped-CLI skill/hook list, info, and check runs in isolated Node 24.22.1 Linux Docker using real agent creation and descriptor installation; hostile controls fall to zero, trusted color remains, JSON compares equal, and Unicode, whitespace, and input files remain intact. The reviewed head changes only the obsolete test option, preserving these proof inputs.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Listing or inspecting installed skills and hooks can execute terminal controls embedded in descriptor metadata.
Reason: The repair restores safe text rendering without changing selection, execution permissions, stored settings, or machine-output contracts.

Merge readiness

✅ Ready for maintainer review

This PR fixes a concrete terminal-rendering defect still present on main; the prior test-type finding is resolved, and no actionable introduced bugs remain.

Priority: P2
Reviewed head: 6b0b3a8c0e55821c1a3bf9b4763239dd98a368a4

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A base-versus-head run of the newly committed regression tests is not recorded, although supplied shipped-CLI comparisons demonstrate the original failure and repaired behavior.
Agent review details

How this fits together

Skill and hook loaders produce raw inventory reports; CLI formatters turn those reports into styled terminal text or JSON.

flowchart LR
  A[Installed descriptors] --> B[Discovery and status owners]
  B --> C[CLI report commands]
  C --> D[Human text sanitization]
  D --> E[Trusted styling and terminal output]
  C --> F[Existing JSON serialization]
Loading

Technical review

Best possible solution:

Merge the focused presentation-boundary repair once existing checks pass, retaining raw descriptors and the established JSON contracts.

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

The unsanitized interpolation paths remain on current main, and supplied built-CLI comparisons demonstrate actual OSC, CSI, and C1 emission from installed descriptors; no target code was executed during this review.

Is this the best way to solve the issue?

The patch uses existing terminal sanitizers at human presentation boundaries, preserves trusted styling and descriptor data, and shares the historical whitespace-preserving implementation without introducing another parser or state owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Skill JSON sanitization and description whitespace keeps the original intent (b6d8374: Remove ANSI/C1 bytes from skill JSON; the later whitespace repair in bfcf106 deliberately preserves tabs, LF, and CR.)
  • Shared requirements and status formatting keeps the original intent (4bf68b9: Consolidate equivalent CLI reporting while preserving output and data contracts.)
  • Hook report ownership keeps the original intent (abc4188: Keep hook formatting in its command owner and remove the single-consumer forwarding module.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit bfcf106 adds src/cli/skills-cli.format.ts:83 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: bfcf10672a35; files: src/cli/skills-cli.format.ts)
  • Vincent Koc: Raw commit 04e103d adds src/cli/skills-cli.format.ts:41 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 04e103d10ef7; files: src/cli/skills-cli.format.ts)

PR surface

Source +20, Tests +133, Docs +7. Total +160 across 8 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 69 49 +20
Tests 3 134 1 +133
Docs 2 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 210 50 +160

Review metrics

Metric Value Why it matters
Production versus test changes Production +69/-49; tests +134/-1 The modest production growth covers distinct human-output fields and shares the existing sanitizer; regressions protect skill rendering, hook rendering, and human-versus-machine errors.

Root-cause cluster

Relationship: canonical
Canonical: #172872
Summary: This PR covers both skill and hook descriptor rendering; two open PRs independently repair narrower portions of the same presentation-boundary failures.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Installed descriptor metadata can alter terminal presentation during routine inventory commands, with a focused repair and limited runtime blast radius.
  • 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 (2 earlier review cycles)
  • reviewed 2026-10-15T07:21:08.013Z sha 3ee9120 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-22T23:33:17.632Z sha d205ee1 :: needs changes before merge. :: [P2] Remove the unsupported managedHooksDir test option

Reviewed October 22, 2026, 7:45 PM ET / 23:45 UTC (Revision 3).

@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 22, 2026
@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Exact head d205ee1: real CLI-created agent/workspace plus shipped local skill/hook installation, not constructed report objects. Raw stdout bytes show actual OSC8/BEL/CSI/C1 controls in main skill/hook list/info/check reports (lists twice), and0 in candidate no-color human reports. Forced-color candidate retains exactly50 skill/30 hook SGR sequences while removing hostile controls. All6 decoded JSON reports equal main after only task-root normalization, preserving existing skill normalization and original hook values; clean Unicode/whitespace controls and input bytes unchanged.35 focused tests, formatting/lint pass. Supporting gpt-5-mini agent smoke returned CLI_LIVE_OK; credential removed. Shared diagnostic construction remains raw, with sanitation only at human presentation boundaries.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 22, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Head 6b0b3a8 fixes the hosted test-type error by removing the regression’s obsolete managedHooksDir option. That option was ignored at runtime; production code and causal proof inputs are unchanged. The corrected hook suite passes12 tests, with formatting/lint passing; the prior four-suite35-test result and installed-loader stdout/JSON/color comparisons remain applicable. A fresh bounded real-provider smoke on this head returned CLI_LIVE_OK using a per-PR-only proof mount and key cleanup. No CI jobs were rerun; this is a committed test API repair.

@clawsweeper clawsweeper Bot added 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. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 22, 2026
@obviyus
obviyus merged commit 1d4ef25 into openclaw:main Oct 22, 2026
114 of 115 checks passed
@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Landed in 1d4ef25. Thanks @Alix-007. Skill and hook reports no longer pass through terminal control sequences.

@obviyus

obviyus commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Merged—thank you @Alix-007 for the descriptor terminal-safety repair. Built installed-loader proof confirmed human controls are neutralized while the six JSON reports, normal Unicode/whitespace, and trusted styling retain their contracts.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…claw#172872)

fix(skills): strip terminal control sequences from skill and hook text in human reports

Strings from installed skills and hooks (names, descriptions, paths) were printed raw in the human-readable skills and hooks list, info and check reports, so an installed skill or hook could put terminal control sequences into your terminal. Human reports now pass those strings through the shared terminal-safe text owner, keeping OpenClaw's own colors; JSON reports are unchanged.

Evidence: built CLI with a skill and a hook installed through the shipped agents add, skills install and plugins hook install commands. On main the six human reports contained 18/24/12 controls for skills and 18/30/12 for hooks, including OSC 8, CSI and C1 (twice); with this change they contain none, OpenClaw's own colors stay, and all six JSON reports are identical. Production +69/-49.

Thanks @Alix-007.

Co-authored-by: Ayaan Zaidi <[email protected]>
steipete added a commit that referenced this pull request Oct 24, 2026
#172872 wrapped hooks read failures in the single-line terminal sanitizer,
so owner remedies such as the remote-Gateway "Config:/Fix:" lines reached
stderr as literal \n escapes while the JSON envelope kept real newlines.
Sanitize each line instead: controls are still stripped, line breaks stay.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
openclaw#172872 wrapped hooks read failures in the single-line terminal sanitizer,
so owner remedies such as the remote-Gateway "Config:/Fix:" lines reached
stderr as literal \n escapes while the JSON envelope kept real newlines.
Sanitize each line instead: controls are still stripped, line breaks stay.
@Alix-007

Copy link
Copy Markdown
Contributor Author

Thanks @obviyus for the extra verification and for landing this!

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: M 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