Repository navigation
fix(tool-display): don't render shell redirects or rg --files as search targets - #133783
Conversation
…arch targets
`rg --files` takes no pattern, so every positional is a path, but the exec
summary read `positional[0]` as the pattern. `positionalArgs` also keeps shell
redirect tokens, and the summary uses the LAST positional as the target.
Together those made
rg --files autonomy .openclaw 2>/dev/null
render as `search "autonomy" in 2>/dev/null`, naming a redirect as the path that
was searched. The same shape appeared in an agent failure notification, where it
read as though a file called `2>/dev/null` had been searched and sent debugging
down the wrong path.
Redirect filtering is deliberately applied only inside the grep/rg branch rather
than in `positionalArgs`. Other summaries already render redirect operators --
`cat > file <<EOF` renders as `show >` and is covered by an existing test -- so
filtering globally would change long-standing unrelated output.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01YbWMfBs2sgfwzkDkmnLSEB
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 31, 2026, 8:52 PM ET / September 1, 2026, 00:52 UTC. ClawSweeper reviewWhat this changesThe PR replaces the shell-word parsing used for agent tool-progress displays so shell redirects are excluded from summaries and Merge readiness⛔ Blocked until stronger real behavior proof is added - 3 items remain No blocking code findings: the prior lexical and option-boundary concerns are addressed at the shared display owner. Keep this PR open until it has inspectable after-fix behavior evidence and exact-head checks complete. Priority: P2 Review scores
Verification
How this fits togetherAgent tool calls are converted into concise, privacy-aware progress text for transcripts, channel updates, CLI output, and the TUI. This formatter receives command text and emits explanatory or raw display text without changing command execution. flowchart LR
A[Agent tool call] --> B[Shell command text]
B --> C[Shell syntax parser]
C --> D[Command summary formatter]
D --> E[Transcript and channel display]
D --> F[CLI and TUI display]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +133, Tests +45. Total +178 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single lexical parser and focused regression table, attach a redacted after-fix formatter or mock-gateway trace, then merge once exact-head checks are green. Do we have a high-confidence way to reproduce the issue? Yes: current main retains redirect operands in its word list and then chooses the last positional item for grep/ripgrep display text; the new focused cases directly cover that owner path. Is this the best way to solve the issue? Yes: handling redirects before quote removal at the shared shell-word owner is the maintainable solution, because it preserves literals and corrects sibling command summaries without a search-only workaround. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2fb27b8d3724. 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
HistoryReview history (1 earlier review cycle)
|
Retain quote provenance while excluding complete redirections, and use one option parser for value-taking flags and positional boundaries. Correct ripgrep file-list mode and inherited cat/head/tail/copy summaries without changing execution or command-text privacy. Co-authored-by: darioandyoshi-tech <[email protected]>
Merge trusted main with the landed clock-scoped provider fixtures addressing the observed CI failures. Keep the reviewed shell display owner and regression files byte-identical to the passing focused and actual Gateway proof. Co-authored-by: darioandyoshi-tech <[email protected]>
|
Merged via squash.
|
…arch targets (openclaw#133783) * fix(tool-display): don't render shell redirects or `rg --files` as search targets `rg --files` takes no pattern, so every positional is a path, but the exec summary read `positional[0]` as the pattern. `positionalArgs` also keeps shell redirect tokens, and the summary uses the LAST positional as the target. Together those made rg --files autonomy .openclaw 2>/dev/null render as `search "autonomy" in 2>/dev/null`, naming a redirect as the path that was searched. The same shape appeared in an agent failure notification, where it read as though a file called `2>/dev/null` had been searched and sent debugging down the wrong path. Redirect filtering is deliberately applied only inside the grep/rg branch rather than in `positionalArgs`. Other summaries already render redirect operators -- `cat > file <<EOF` renders as `show >` and is covered by an existing test -- so filtering globally would change long-standing unrelated output. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01YbWMfBs2sgfwzkDkmnLSEB * fix(agents): parse shell redirects before display arguments Retain quote provenance while excluding complete redirections, and use one option parser for value-taking flags and positional boundaries. Correct ripgrep file-list mode and inherited cat/head/tail/copy summaries without changing execution or command-text privacy. Co-authored-by: darioandyoshi-tech <[email protected]> --------- Co-authored-by: darioandyoshi-tech <[email protected]> Co-authored-by: Claude Opus 5 (1M context) <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Tool-progress summaries could mistake shell redirection destinations for search paths, and treated
rg --filesas a search pattern. Filtering the decoded words alone also loses the distinction between redirection syntax and a literal quoted search pattern.Move redirect handling into the existing shell-word parser, before quote removal, and consume option values through one shared option parser. This preserves quoted/escaped literals, attached and separated redirects,
--and-e/-fboundaries, and ripgrep glob/type options. The same lexical repair fixes misleadingcat,head,tail, and copy summaries; raw command text keeps its separate opt-in.The old tokenizer and duplicate positional/option scans are removed. The production delta is +133 lines (+244/-111): the lexical state now owns redirection operands and quote provenance, while the search owner declares the existing grep/ripgrep option arity. No new dependency, config, execution behavior, or public API is added. The richer asynchronous shell parser is unsuitable for this synchronous display boundary.
Evidence
--files,--, and explicit patterns.ccdeaf5f92ec724489ebb93c20d38b2255fdb76bincludes an ordinary merge of main; all four display owner/test files are byte-identical to the independently proven candidate. Exact-head CI run 33457433301 passed, including the required gate.Review follow-through
The prior ClawSweeper findings about quoted redirection-like patterns and option boundaries are addressed at the lexical owner. Separated/attached redirects and glob/type values have focused coverage. The nearby hidden bug in sibling display summaries is fixed by the same parser rather than retained as a misleading display contract.
CI follow-through
The preceding head encountered two provider pricing tests whose expected introductory prices expired when the UTC date changed. The ordinary main merge includes the canonical clock-scoped fixture fix from #134564; no pricing production behavior changed. A separate job failed while downloading the Matrix crypto binary during dependency installation, before its tests ran. The prior PR-context check also required the exact Problem/Evidence headings, which this body now supplies. Final-head checks have now passed without changing the proven display-owner bytes or weakening assertions.
Observable Gateway proof
The following is the actual saved verdict from two ephemeral Gateway runs using the QA channel and a mock provider, with real shell execution. A task-only probe at the channel
onToolStartsink recorded the existing shared progress formatter's output. The commands and paths are synthetic. This is trusted-main equivalent execution with the candidate's exact display-owner bytes; those bytes are unchanged atccdeaf5f92ec724489ebb93c20d38b2255fdb76b. It is not a live external-channel test. Source instrumentation was restored and the clean runtime rebuilt afterward.All six starts retain the default command-text privacy behavior (
🛠️ Exec). With the existing command-text opt-in, explain mode gives the corrected summaries and raw mode additionally retains the original command.{ "complete": true, "runtime": "v24.20.0", "results": [ { "mode": "explain", "status": "pass", "events": [ { "toolName": "exec", "args": { "command": "rg --files -g '*.ts' source 2>err" }, "detailMode": "explain", "defaultLine": "🛠️ Exec", "optInLine": "🛠️ list files in source" }, { "toolName": "exec", "args": { "command": "rg '2>/dev/null' source/file.ts 2>err" }, "detailMode": "explain", "defaultLine": "🛠️ Exec", "optInLine": "🛠️ search \"2>/dev/null\" in source/file.ts" }, { "toolName": "exec", "args": { "command": "grep -e needle source/file.ts 2>err" }, "detailMode": "explain", "defaultLine": "🛠️ Exec", "optInLine": "🛠️ search \"needle\" in source/file.ts" } ] }, { "mode": "raw", "status": "pass", "events": [ { "toolName": "exec", "args": { "command": "rg --files -g '*.ts' source 2>err" }, "detailMode": "raw", "defaultLine": "🛠️ Exec", "optInLine": "🛠️ list files in source, `rg --files -g '*.ts' source 2>err`" }, { "toolName": "exec", "args": { "command": "rg '2>/dev/null' source/file.ts 2>err" }, "detailMode": "raw", "defaultLine": "🛠️ Exec", "optInLine": "🛠️ search \"2>/dev/null\" in source/file.ts, `rg '2>/dev/null' source/file.ts 2>err`" }, { "toolName": "exec", "args": { "command": "grep -e needle source/file.ts 2>err" }, "detailMode": "raw", "defaultLine": "🛠️ Exec", "optInLine": "🛠️ search \"needle\" in source/file.ts, `grep -e needle source/file.ts 2>err`" } ] } ] }