Skip to content

fix(git-read): sanitize call-label display text - #582

Open
ooiuuii wants to merge 1 commit into
openpi-dev:mainfrom
ooiuuii:fix/git-call-display-sanitization
Open

ooiuuii wants to merge 1 commit into
openpi-dev:mainfrom
ooiuuii:fix/git-call-display-sanitization

Conversation

@ooiuuii

@ooiuuii ooiuuii commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

Problem

Fixes #581.

Git call labels can render terminal control bytes before argument validation runs. git_show, git_diff, and git_log interpolate raw revision/path/file text into Pi's call-label component; rejecting the later execution does not sanitize that earlier display.

Value

Keep call-label output safe and single-line while preserving the exact arguments used for validation and execution.

Approach

Sanitize each final call label with the existing sanitizeTerminalText, then normalize whitespace. All three sibling Git tools use the same small helper. The existing file-search argument-display pattern provides the precedent.

This branch is independent of #570's result failure status, #564's Git argument separator, and #368's process helper refactor. No execute, argv, result, or schema changes are included.

Validation

  • Actual registered tools and native ToolExecutionComponent: harmless title-control markers appear in output before the fix and are absent after it. Actual execute calls still reject the original arguments.
  • New tests before production change: 6 fail / 1 pass. Fixed complete focused Git group: 20/20 pass.
  • Coverage: all displayed input positions, OSC/CSI/bidi controls, single-line normalization, argument immutability, Unicode paths and ordinary labels/options.
  • bun run check, git diff --check, one scoped read-only review — pass/no actionable findings.
  • This proves sanitized component output, not an observed terminal takeover. No private data or live provider calls. Full local suite not claimed green due separately reproduced host baseline timeouts and Windows cleanup hangs; broader fresh CI remains pending.

Impact

  • User-visible: call labels no longer carry input control bytes or extra lines.
  • Model-visible context/tool schema: unchanged.
  • Runtime/lifecycle and persisted config/data: unchanged.
  • Compatibility/risk: display-only cleanup; canonical arguments and execution validation remain untouched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(git-read): call labels render control bytes before validation

1 participant