Skip to content

fix(terminal): strip C1 OSC payloads from output#103672

Merged
steipete merged 1 commit into
mainfrom
fix/c1-osc-terminal-text
Jul 10, 2026
Merged

fix(terminal): strip C1 OSC payloads from output#103672
steipete merged 1 commit into
mainfrom
fix/c1-osc-terminal-text

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #103661

What Problem This Solves

Fixes an issue where terminal snapshots and sanitized agent output exposed OSC title, hyperlink, or clipboard payload text when a producer used the 8-bit C1 OSC introducer (U+009D). The delimiters were removed later, but the metadata payload remained visible as ordinary terminal text.

Why This Change Was Made

The shared terminal scanner now recognizes both ECMA-48 OSC introducers and all three supported string terminators through common pattern constants. The compatibility scanner keeps its historical broad payload behavior, while the sanitizing scanner keeps its stricter payload rules; only C1 OSC handling changes. The fast path also recognizes U+009D so these sequences reach the scanner.

User Impact

Terminal snapshot text and downstream sanitized output no longer display metadata carried in C1 OSC sequences. Adjacent emoji, CJK text, and prompts remain unchanged.

Evidence

  • Current-main Testbox repro (4cc5304178): \u009D0;title\u009Cprompt$ rendered as 0;titleprompt$; expected prompt$.
  • Regression matrix: ESC and C1 OSC introducers crossed with BEL, ESC-ST, and C1-ST terminators, with adjacent emoji/CJK preservation.
  • Focused Testbox proof: terminal-core, gateway terminal, terminal server-method, and bash executor suites; 67 tests passed.
  • Post-mutation Testbox proof: terminal-core and gateway terminal suites; 39 tests passed.
  • Mutation proof: removing C1 OSC recognition failed exactly the existing C1 sanitizer case plus the three new C1 matrix rows; ESC rows remained green.
  • corepack pnpm check:changed passed on Testbox (guards, tsgo core/core-test, lint, and scoped repository checks).
  • corepack pnpm format:check packages/terminal-core/src/ansi.ts packages/terminal-core/src/ansi.test.ts src/gateway/terminal/buffer-text.test.ts passed.
  • Fresh autoreview: no accepted or actionable findings.

AI-assisted implementation and review.

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Jul 10, 2026
@steipete steipete added bug Something isn't working P2 Normal backlog priority with limited blast radius. labels Jul 10, 2026
@steipete steipete self-assigned this Jul 10, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Jul 10, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready at exact head 62a8b57f89032b16e5a8035db7039371c1230d93.

Proof:

  • Exact current-main failure reproduced on Testbox: \u009D0;title\u009Cprompt$ rendered as 0;titleprompt$ before this fix.
  • Focused Testbox (tbx_01kx5wqe7ba3qdpxmcse36y91g): terminal-core, gateway terminal, terminal server-method, and bash executor suites; 67 tests passed.
  • Post-mutation focused Testbox: terminal-core and gateway terminal suites; 39 tests passed.
  • Mutation check: removing C1 OSC recognition failed exactly the intended four C1 cases; ESC cases stayed green.
  • corepack pnpm check:changed: passed on Testbox, including guards, tsgo core/core-test, lint, and scoped repository checks.
  • Targeted format:check: passed.
  • Fresh autoreview: no accepted/actionable findings.
  • Repo-native review artifacts: validated, zero findings, READY FOR /prepare-pr.
  • Exact-head hosted CI: green — https://github.com/openclaw/openclaw/actions/runs/29090789073
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 103672: passed with hosted_exact_or_recent_rebase evidence bound to the exact head.

The separate problem of escape sequences split across output chunks is deliberately excluded and tracked in #103668.

@steipete
steipete merged commit a13d2c4 into main Jul 10, 2026
130 of 132 checks passed
@steipete
steipete deleted the fix/c1-osc-terminal-text branch July 10, 2026 12:02
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

bug Something isn't working gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: C1 OSC payloads leak into terminal snapshot text

1 participant