Repository navigation
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — this run reviewed the single commit adding the BufferLine retention patch across headless/desktop/mobile, the source-map provenance harness, and the new regression/audit evidence.
BufferLinepatch (headless/desktop/mobile) — releases combined strings and unused extended attrs on overwrite/erase/shift; setters check the old_dataflag before clearing,copyCellsFromchecks the destination map because the destination flags were already copied. Wide chars, protected cells, overlapping copies, reflow, and the deprecatedset()path are preserved.- New
@xterm/headlesspatch — headless ships nosrc/, soconfig/patches/xterm-upstream.jsondeclares both published maps + prefixes andassertMappedSourcesMatchbyte-compares every embedded source against the checkout before and after patching. regenerate-xterm-patches.mjs—sourceRootFor/sourceDirrooting,generatedPaths-driven cleanup, and a sourceMaps branch that replaces the src-hunk comparison.- Mobile regeneration —
MOBILE_SOURCESnow selectsColorContrastCache.ts+BufferLine.ts; the mobile patch and lockfile are rekeyed. - Tests & audit —
headless-cell-retention.test.ts(17 cases), the generated mobile WebView engine test, and thedocs/audits/terminal-cell-retention/reproductions.
Independently verified: patch hashes match both lockfiles, the headless bundle patch dry-runs clean against the pristine package and embeds source byte-identical to the .src.patch applied to the pristine map (semantic-results.json shas reproduced), the BufferLine stanza is identical across all three source patches, 45 harness tests pass, and the regression suite fails 15/17 on the reversed pristine engine while passing 17/17 patched.
Two non-blocking notes: the manifest carries no upstream pointer for this BufferLine fix (unlike the addon-search entry), so any future upstream fix would not be discoverable from the manifest; and the measured ~5% parse-path cost is a real, documented tradeoff rather than a free win.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — this run re-reviewed the two commits pushed after the prior pullfrog review (43e0a96); both are test-side only, so production behavior is unchanged.
- Mobile payload gate corrected —
terminal-webview-payload-hash.test.tsnow expects241cb377…/731258, replacing the stale25b800f3…/730472that did not match the emitted document. - Typed test access —
headless-cell-retention.test.tsreplaces theReflect.getchains with a typedbuffer()helper, andline()now throws on a missing row instead of yieldingundefined.
Independently verified this run: a frozen pnpm install in mobile/ regenerates terminal-webview-engine.generated.ts deterministically (identical sha on rebuild), and the new 241cb377…/731258 value matches the emitted document. The mobile payload-hash test, mobile terminal-webview-cell-retention.test.ts, and the 17-case root headless-cell-retention.test.ts all pass, with pnpm tc:node clean.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the only commit pushed since the prior pullfrog review (5b4b27d) is bb99800, and it is a zero-diff merge: git diff 5b4b27d bb99800 is empty, so no file content changed.
- Base-branch sync — the base had advanced by one commit (
05caeb6, which set the contrast-only payload expectation tobdd9b21a…/730693). The merge resolves theterminal-webview-payload-hash.test.tsconflict by keeping the PR's241cb377…/731258, the correct expectation once theBufferLinechange is folded into the contrast engine. That base commit touched only that same test file, so nothing else from the base was dropped.
Re-confirmed the merged head: the payload-hash test passes against a freshly regenerated mobile engine, and the merged tree is byte-identical to the already-verified 5b4b27d.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — this run re-reviewed the one commit pushed after the prior pullfrog review (bb998003); it is audit-harness only, so no shipped patches, lockfiles, or CI-run tests change.
- Audit fixture loading rewritten —
semantic-review.cjsreplaces its bespoketransformSync+new Functionmodule loader with an esbuild bundle written to a temp file andrequired; the baseline and patched variants are pre-bundled once inside an asyncmain()and the emitted code is passed intofixture/semanticCheck/retentionCheck. - Throughput bundle loading switched to real modules —
throughput.cjswrites its esbuild output to a temp.cjsfile andrequires it (deleting the cache entry) instead of evaluating the bundle text throughnew Function.
No product or CI surface changed: docs/audits/terminal-cell-retention/ is a manual reproduction harness with no workflow or package-script reference, the retention assertions are unchanged, node --check passes on both scripts, and the bundle's auditScratchChars export still reaches the entry through export * from BufferLine.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
Resolve mobile lock metadata with the pnpm 12 hash format while retaining all patch hashes.
Resolve mobile lock metadata with the pnpm 12 hash format while retaining all patch hashes.
There was a problem hiding this comment.
Important
The two new commits edit the hand-authored BufferLine source patches to guard the translated-line-cache clear behind _cacheValid, but the generated bundle patches, the derived mobile source patch, and both lockfiles were not regenerated. This breaks the test job (two unit tests fail) and both xterm_patch_sync checks, and the optimization never reaches the packages Orca installs. Regenerating all artifacts resolves it.
Reviewed changes — this run re-reviewed the two commits pushed after the prior pullfrog review (ccac7bb908); both change only the source-of-truth BufferLine patches, so no test, bundle, lockfile, or harness content changed.
- Conditional cache invalidation —
set,setCell,setCellFromCodepoint,addCodepointToCell,insertCells,deleteCells,replaceCells,resize,fill, andcopyCellsFromnow runthis._cache = ''only whenthis._cacheValid, collapsing repeated clears within one mutation burst into one. - Source patches only —
config/patches/xterm-src/@[email protected]andconfig/patches/xterm-src/@[email protected]were edited; the corresponding generated bundles, mobile artifacts, and lockfile hashes were not touched.
The conditional itself is semantically equivalent to the unconditional clear: _cache is only non-empty while _cacheValid is true (only translateToString writes it non-empty and sets valid in the same expression; the constructor and copyFrom reset both together), so clearing on the first invalidation still releases the retained string.
ℹ️ Nitpicks
- The audit evidence is now stale:
docs/audits/terminal-cell-retention/semantic-results.jsonrecordspatchedBufferLineSha256: 435b6bcc…, butsemantic-review.cjsreads the source patch dynamically, so rerunning it after regeneration will record a different sha. Rerun the audit and update the recorded results.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
47bb299 to
94105d9
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — this run re-reviewed the merge 7bbfceb5c0 pushed after the prior pullfrog review (314fa9063c); it regenerates every generated xterm artifact from the already-reviewed conditional-cache source patches and refreshes the branch onto the current #20981 base.
- All generated bundles rebuilt — the headless, desktop, and mobile
.patchfiles now embed the conditional_cacheValidclear (10 methods × CJS+ESM = 20 occurrences each, zero unconditional), so the perf change actually reaches the packages Orca installs. - Lockfiles rekeyed — both
pnpm-lock.yamlfiles carry hashes matching the committed patches (headless0fb99f65…, desktop83bc5c44…, mobile4c96c6e1…). - Mobile artifacts regenerated — the generated WebView engine and its payload-hash expectation now read
87d7e96d…/731458 and pass. - Audit evidence refreshed —
semantic-results.jsonrecordspatchedBufferLineSha256: e521a463…, matching the source embedded in every bundle map, anddiffis now a direct devDependency so the audit no longer relies on hoisting. - Docs and PR body updated — the audit README and PR description document the repair rather than the earlier malformed state.
Independently verified this run: every bundle map's embedded BufferLine.ts hashes to e521a463… (headless, desktop, and mobile, CJS and ESM); reverse-applying the headless source patch to that embedded source is clean and reproduces baseline 26551bd2…, so the hunk counts and src↔bundle provenance agree; all root and mobile lockfile patch hashes match; 62 patch-generation/source-map/headless-emulator tests and 17 mobile WebView tests pass after a frozen mobile install; working tree clean. Both prior-review inline threads were already resolved. The full xterm_patch_sync --check (which rebuilds pinned upstream) was not run here as it has no offline path, but the embedded-source, lockfile, and committed-artifact checks all agree.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — this run re-reviewed the one commit pushed after the prior pullfrog review (7bbfceb5c0); it is test-infrastructure only, so no shipped patch, bundle, lockfile, or product behavior changes.
- Zsh startup wait —
runZshPtynow awaits the shell's first byte (firstData) before starting its 250ms quiescence check, so silence during a slow startup no longer reads as a ready prompt and the queuedPS1command cannot be consumed by a latecompinitquestion. - Deterministic regression test — the new
zsh-startup-hook-pty-harness.test.tsmocksnode-ptywith fake timers, asserts nothing is written during 500ms of startup silence, then walks compinit, the prompt, and exit. - Mobile canvas mock cast —
terminal-webview-contrast-cache.test.tsswitches thegetContextmock cast toas unknown as CanvasRenderingContext2Dunder its existingSAFETY:disable (compile-time only).
Verified this run: the new test fails against the pre-fix harness (it writes PS1 during startup silence) and passes at head, so it is a real regression guard; oxlint reports 0 warnings / 0 errors on all three changed files; working tree clean. Both prior-review inline threads were already resolved and remain so.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — this run re-reviewed the three commits pushed after the prior pullfrog review (0fe628456e); all three register the new zsh startup harness test with the CI shell lane, so no product code or shipped xterm patch changed.
- Shell lane registration —
.github/workflows/pr.ymllistssrc/main/zsh-startup-hook-pty-harness.test.tsin the real-shell contract step, and.github/workflows/unit-tests.ymlexcludes it from the sharded suite. - Lane guard updated —
config/scripts/pr-workflow-parallelism.test.mjsadds the file toshellContractFiles, which thekeeps every real-zsh test in the dedicated shell laneglob asserts must exactly match the tests that importzsh-startup-hook-pty-harness. This fixes the guard, which failed at0fe6284once the new harness test existed but was absent from the lane list.
Verified this run: pr-workflow-parallelism.test.mjs passes 19/19 (including the real-zsh lane guard) and zsh-startup-hook-pty-harness.test.ts passes 1/1. The three registration sites are consistent and their placement matches the neighbouring entries.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
009e86a to
4f990f2
Compare
|
Closing: the retained strings are capped at one per column per line and freed when the line leaves scrollback, so real-world memory is negligible. The fix costs ~4.9% parser throughput on every printed character. It also has no merge base with main, which has moved to xterm beta.304, and it bundles #20981 plus ~4.8k lines of audit artifacts. |

ELI5
Erasing terminal text can leave the old strings hidden in memory. This change releases those strings once they no longer belong to a live cell, so cleared output can release its memory too. Existing terminal text and scrollback capacity are preserved.
What Changed
The shared terminal line implementation clears invalid text caches, removed combining-character strings, unused extended attributes, and a temporary cell used while shifting columns. Valid cached text is invalidated only once per mutation burst. Desktop, daemon/headless, and mobile packages are regenerated from the same reviewed source changes.
This branch now includes the refreshed #20981 base. The malformed source-patch hunk counts, stale generated bundles/maps, mobile source mismatch, lockfile hashes, and generated mobile payload expectation are repaired. Both review-bot threads are addressed.
Why
In a synthetic combining-text fixture, erasing eight cells previously left about 42.9 MiB reachable; the fixed runs retain about 0.1–0.2 MiB. A live 100,001-character cell retains all its text. Ordinary short graphemes retain much less, so this demonstrates a leak mechanism rather than proving the cause of a production OOM.
Removing dead references preserves text and history, while imposing a text-length or scrollback limit would discard live content.
Tradeoff and current gate
Requires #20981 first. No text, color, or scrollback loss was found in the checked cases. Cleanup has a measurable CPU cost: the freshly rebuilt headless bundle parsed synthetic 1.2 MB ASCII writes in 8.04 ms versus 7.665 ms before, about 4.9% slower. That is roughly 0.38 ms per write in this fixture, not an application-wide slowdown estimate. This cost remains; the PR does not claim zero performance tradeoff.
Linked Issue
Related to #19768 and #19831 as memory hardening; neither incident is claimed resolved by this synthetic evidence.
Visual Proof
N/A — this changes internal ownership of erased strings. Automated live-cell comparisons and generated-mobile-engine tests cover the affected behavior; no running-app UI capture is claimed.
Testing
On macOS arm64 / Node 24.20.0:
--checkrebuilds pass.Current audit evidence
Review
The generated-artifact blockers are removed. Wait for current CI, and merge after #20981. The remaining decision is whether the measured parser cost is acceptable for reclaiming erased terminal text; evidence does not establish the frequency or size of this leak in ordinary user sessions.