Evidence for [#42810](https://github.com/pingdotgg/t3code/pull/42810). Fresh isolated servers, synthetic projects/threads, Replay only for thread seeding; all terminal output comes from a real shell/PTY. Web: Chromium 156, 1280×800, light theme. Mobile: Pixel 9, Android 36, 1080×2424, light theme, Gboard visible. Each side serves its own commit.

Steps: keep the web drawer attached, emit an unfinished OSC title, Clear through the shared RPC, then emit its tail/BEL and visible output; capture attached and after reattach. Repeat with ESC[ followed by six line feeds already executed before Clear, then complete with m and visible output. The head places ready-CSI on the first row, without replaying those line feeds.

### Scenario: Clearing a split OSC or CSI keeps attached and reattached terminals correct

**Proven: the scenario fails on base [c478fde9fe](https://github.com/pingdotgg/t3code/commit/c478fde9fe323fd6d10ef9a0b109b015546fb8e0) and passes on head [d1e061586b](https://github.com/pingdotgg/t3code/commit/d1e061586b008c005f6876229afa148c18ffa0e2).**

|  | Base [c478fde9fe](https://github.com/pingdotgg/t3code/commit/c478fde9fe323fd6d10ef9a0b109b015546fb8e0) | Head [d1e061586b](https://github.com/pingdotgg/t3code/commit/d1e061586b008c005f6876229afa148c18ffa0e2) |
| --- | --- | --- |
| Result | ❌ failed<br>ASSERTION_FAILED: expected {"osc-attached":"progressready-OSC","osc-reattached":"progressready-OSC","csi-attached":"mready-CSI","csi-reattached":"mready-CSI"} to equal {"osc-attached":"ready-OSC","osc-reattached":"ready-OSC","csi-attached":"ready-CSI","csi-reattached":"ready-CSI"} | ✅ passed |
| osc unfinished before clear | ![Base c478fde9fe: osc unfinished before clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/83f40173c54bc7fc/001-osc-unfinished-before-clear.png) | ![Head d1e061586b: osc unfinished before clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/1818d925ef54be46/001-osc-unfinished-before-clear.png) |
| osc attached after clear | ![Base c478fde9fe: osc attached after clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/eca063d305fcdd81/002-osc-attached-after-clear.png) | ![Head d1e061586b: osc attached after clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/8cbb8bffc63c3fcf/002-osc-attached-after-clear.png) |
| osc reattached after clear | ![Base c478fde9fe: osc reattached after clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/13493656c4e29bc3/003-osc-reattached-after-clear.png) | ![Head d1e061586b: osc reattached after clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/c74aa77061b0e49a/003-osc-reattached-after-clear.png) |
| csi unfinished before clear | ![Base c478fde9fe: csi unfinished before clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/8c6e7219dce01e53/004-csi-unfinished-before-clear.png) | ![Head d1e061586b: csi unfinished before clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/8918f807ad294951/004-csi-unfinished-before-clear.png) |
| csi attached after clear | ![Base c478fde9fe: csi attached after clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/690831b960ba42a1/005-csi-attached-after-clear.png) | ![Head d1e061586b: csi attached after clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/b9fe21aab4fc9783/005-csi-attached-after-clear.png) |
| csi reattached after clear | ![Base c478fde9fe: csi reattached after clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/2e995949837cc21c/006-csi-reattached-after-clear.png) | ![Head d1e061586b: csi reattached after clear](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/8efa7d12f2de54d3/006-csi-reattached-after-clear.png) |
| failure | ![Base c478fde9fe: failure](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/ebf36aed6690bef3/007-failure.png) |  |
Uploaded reproducer: [split-terminal-clear.e2e.ts](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/0455b4de43ec3a68/split-terminal-clear.e2e.ts). Both sides were rerun by scenarios:prove; the completed proof reports failsOnBase=true and passesOnHead=true. Web recordings start at the synthetic PTY driver’s ready message, before either reproduction.

Android steps: open the seeded terminal, show the software keyboard, reveal the toolbar Clear key, type `printf '\033]0;Build '; sleep 8; printf 'progress\a'; printf 'ready\n'`, press Enter, then tap Clear during the sleep. Base shows progressready; head shows ready. The fallback pass uses the identical command via terminal.write so its submit behavior does not dismiss the keyboard; Clear is still tapped in the real Android toolbar. Only optional native-terminal availability exports are disabled by the uploaded fixture, on both sides; output parsing/rendering remains the shipped code.

Queued-exit steps: a diagnostic subscriber suspends one real server output drain; real PTY bytes queue behind it. Clear, send more output, inspect ownership, then release. Repeat with a real PTY exit(42) queued before Clear. No process events or exit statuses are fabricated. Base clears ownership, drains later output concurrently, and drops the queued exit, leaving a stale running drawer. Head retains the original drain and exit, then closes the drawer after delivering exit 42.

| Capture | Before [c478fde9fe](https://github.com/pingdotgg/t3code/commit/c478fde9fe323fd6d10ef9a0b109b015546fb8e0) | After [d1e061586b](https://github.com/pingdotgg/t3code/commit/d1e061586b008c005f6876229afa148c18ffa0e2) |
| --- | --- | --- |
| Android native result | ![Before: Android native result](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/0dfc9ba26a2df703/android-base-result.png) | ![After: Android native result](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/9824f11f6a090c29/stable.png) |
| Android text fallback result | ![Before: Android text fallback result](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/f39c008beee97cb0/android-fallback-base-2-result.png) | ![After: Android text fallback result](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/a6359035600a156d/stable.png) |
| Queued exit, final recording frame | ![Before: Queued exit, final recording frame](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/629fa62382a019bd/drain-base-final.png) | ![After: Queued exit, final recording frame](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/37651d7bf5a712a8/drain-head-final.png) |

| Recording | Before | After |
| --- | --- | --- |
| Web attached, CSI and reattach | [Before recording](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/6cf8f955d25e078e/web-base.mp4) | [After recording](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/41bc207864f9ceab/web-head.mp4) |
| Android native Clear key | [Before recording](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/4e67ee927c9483b4/android-base.mp4) | [After recording](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/da1683047d1f676c/interaction.mp4) |
| Android text fallback Clear key | [Before recording](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/5ba254c709728ed3/android-fallback-base-2.mp4) | [After recording](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/6406fabdeead5251/interaction.mp4) |
| Real drain and queued exit | [Before recording](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/b301b184c1ea05c7/video.webm) | [After recording](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/86689d658484f991/video.webm) |

Runtime traces: [before](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/1d44b6554b4a775f/drain-c478fde9fe.json), [after](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/7dbaa39264c9cfcf/drain-d1e061586b.json). Before Clear both contain a real queued exit 42; after drain release base remains running/exitCode=null, head is exited/exitCode=42.

Drivers: [terminal-drain-clear.e2e.ts](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/e66773ca8e742ee1/terminal-drain-clear.e2e.ts), [terminal-drain-gate.ts](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/eb16c4884cf2e2ae/terminal-drain-gate.ts), [mobile-terminal-seed.ts](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/fc01a9d64e013da1/mobile-terminal-seed.ts), [terminal-proof-control.ts](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/61c7124ce0c35667/terminal-proof-control.ts), [force-fallback.mjs](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/7e9b4fae866225b4/force-fallback.mjs), [mobile-capture.py](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/1467776f9fd0316e/mobile-capture.py).
