GeezerVison is showing github.com — fix(web): keep interrupted terminal pastes free of stray Escape characters by StiensWout · Pull Request #42916 · pingdotgg/t3code
Conversation
Hiding the terminal drawer near the end of a large bracketed paste could leave an extra Escape character in the shell input. The terminal writer now keeps the closing marker in a single write, so recovery can send the full marker without duplicating a prefix.
Related: #36902, #35419, #37889, #42686, #30577
Reproduction on main
Commit b61af8a5d2 (main), in the running web app:
- Open the web app and a thread, then open the terminal drawer and wait until a Bash prompt is ready.
- Slow the browser's connection to the app so a large paste takes a few seconds to send.
- Paste 65,529 ASCII characters, such as the letter p repeated that many times, into the terminal.
- Close the terminal drawer before the paste finishes sending.
- Open the terminal drawer again and look at the end of the text on the Bash input line.
The input line shows those characters followed by ^[, an extra Escape left when the paste was closed. Expected: The input line shows those 65,529 characters and nothing after them.
The cause is at apps/web/src/components/terminal/terminalInputWriter.ts:64. Ran cd apps/web && pnpm exec vp test run src/components/terminal/terminalInputWriter.test.ts with the repro test added: it failed in 2 of 2 runs on a clean checkout, with expected '"\u001b\u001b[201~"' to be '"\u001b[201~"' // Object.is equality in the output.
Evidence
Environment: Linux x64, the repository's own tests.
Proven: the repro fails at the test commit c272c7df8c and passes on the head 0a0303c3f6, both on main b61af8a5d2.
|
Before |
After |
| Commit |
c272c7df8c |
0a0303c3f6 |
| Result |
failed with "expected '"\u001b\u001b[201~"' to be '"\u001b[201~"' // Object.is equality" |
passed |
Outside view: a person sees it in the running web app by following the steps under Reproduction on main.
Tests
- c272c7df8c adds the failing test, alone, before the fix.
pnpm exec vp run check:changed b61af8a5d2af5e514674bd85fe5a62e4ea8f9918 passed on head.
Not in this change
- Native mobile paste uses a separate input path without this bracketed-paste recovery.
- Recovery after a lost acknowledgment for a fully dispatched closing marker still depends on the existing write acknowledgment semantics.
- Empty input and terminal settings are independent of bracketed-paste chunking.
Who did the work
- Repro written by GPT 6.2 Sol, in Codex
- Outside view by Grok 4.7, in Grok
- Written by GPT 6.2 Sol, in Codex
- Trimmed by Claude Opus 5.5, in Claude Code
- Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex, and by Gemini 4 Neon, in Antigravity
- Reproduction, checks and proof run by a program on base and head, not by an agent
Made in T3 Code by GPT 6.2 Sol, Grok 4.7, Claude Opus 5.5 and Gemini 4 Neon
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
The terminal input writer now keeps the bracketed-paste closing marker intact when a chunk boundary would split it. A new test covers cancellation before dispatch of the next chunk.
Changes: Bracketed Paste Recovery
| Layer / File(s) |
Summary |
Chunk boundary recovery and test apps/web/src/components/terminal/terminalInputWriter.ts, apps/web/src/components/terminal/terminalInputWriter.test.ts |
The writer identifies bracketed paste input before sending chunks. If the final chunk is shorter than the closing marker, it rechunks the preceding data and sends the complete marker as the final chunk. A new test checks that the output retains the marker after cancellation before dispatch. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related PRs
- pingdotgg/t3code#42897: This PR also addresses split bracketed-paste chunks and closing-marker handling during pending terminal writes.
Suggested reviewers: juliusmarminge, macroscopeapp
Merge Risk: Minimal · up to 0a030
-
This change keeps the bracketed-paste closing marker in one write, preventing a stray Escape character in shell input. It is narrowly scoped and covered by a regression test, and no merge-blocking risk was found.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title names the fix (interrupted terminal pastes no longer leave stray Escape characters) and matches the summarized change in terminalInputWriter.ts, which keeps the closing marker in one write d… |
| Description check |
 |
The description follows the template's main sections. Problem, Change, Scope, and Verification are all present. It gives a reproduction on main, links the related issues, and reports failing and passi… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Title check
-
Explanation
The title names the fix (interrupted terminal pastes no longer leave stray Escape characters) and matches the summarized change in terminalInputWriter.ts, which keeps the closing marker in one write during bracketed-paste recovery. It is specific and conventional, though it is a bit long at 74 characters.
Full details: Description check
-
Explanation
The description follows the template's main sections. Problem, Change, Scope, and Verification are all present. It gives a reproduction on main, links the related issues, and reports failing and passing test evidence at specific commits. Scope links related issues but does not clearly justify why no single primary issue is linked, and it does not state that the bug is an obvious fix. The Verification section includes checks and commit references. The 'Who did the work' section is extra, not required by the template, and it does not contain screenshots, which are required only for UI changes and this is not a UI change.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between b61af8a and 0a0303c.
Files selected for processing: 2
-
apps/web/src/components/terminal/terminalInputWriter.test.ts
apps/web/src/components/terminal/terminalInputWriter.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The automated pipeline stopped on this pull request and will not merge it:
someone else pushed to wf/find-1819614cabb59a8f871e2a1b (head is now 0a0303c); the pipeline does not build on commits it did not review
It stays open for a person to finish or close.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This branch has not been deployed
No deployments
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
takeover:blocked
Takeover blocked; reason in the PR body
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|