Uh oh!
There was an error while loading. Please reload this page.
fix(tui): sanitize clipboard text - #44197
Conversation
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
There was a problem hiding this comment.
Pull request overview
This PR fixes TUI clipboard writes failing when session text contains NUL (\0) characters by sanitizing clipboard text at the shared adapter boundary before handing it to OpenTUI, and adds a regression test to prevent recurrence.
Changes:
- Strip NUL characters from clipboard text in
createClipboardAdapter.writebefore calling@opentui/core’swriteText. - Add a regression test ensuring NUL-bearing text is written without NULs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/tui/src/clipboard.ts | Sanitizes clipboard write input by removing NUL characters before delegating to OpenTUI. |
| packages/tui/test/clipboard.test.ts | Adds a regression test validating NUL characters are removed prior to write. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Enough1122
commented
Aug 23, 2026
Reasonable defensive fix and correctly placed — sanitizing once inside the shared
Otherwise good to merge. |
Issue for this PR
Fixes#44198
Type of change
What does this PR do?
OpenTUI rejects clipboard text containing NUL characters, so shell output with NUL bytes caused
/copyto fail. This strips NUL characters at the shared TUI clipboard boundary and adds a regression test, covering transcript, message, and selection copy paths.How did you verify your code works?
dev:live, ran/copy, and pasted the complete 669 KB transcript with Cmd+V.Screenshots / recordings
Before
Screen.Recording.2026-08-22.at.4.44.08.PM.mov
After
Screen.Recording.2026-08-22.at.4.47.02.PM.mov
Checklist