Skip to content

fix: four more upstream ports — OSC-8 across resize, mobile timestamps, and two hot-path walks - #371

Merged
fabolivark merged 4 commits into
mainfrom
feat/upstream-batch-4
Sep 9, 2026
Merged

fabolivark merged 4 commits into
mainfrom
feat/upstream-batch-4

Conversation

@fabolivark

@fabolivark fabolivark commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 +101 −11 +90
Prod 4 +26 −9 +17

Fourth slice. #368, #369 and #370 carry the first eleven; these four are the cheapest remaining items from the sweep of what upstream has already merged.

upstream Qué arregla Cómo entró
ae35e044f2 any reattach lost the clickability of restored OSC-8 hyperlinks — a same-size resize wiped them cherry-pick limpio
c300913f90 formatCommitTime multiplied ×1000 a timestamp already in milliseconds, so every relative commit time in the phone's history is wrong by a factor of 1000 cherry-pick limpio
2ccf35b135 two redraw call sites still used replace(/[ \t]+$/g, '') 2 líneas
373a670aba containsTerminalVerticalLineControl walked every code unit of every chunk port

The mobile one carried a test that hid it

c300913f90 is the only fully clean cherry-pick out of the 89 candidates the sweep verified, and it fixes a live bug: git-history-log-parser.ts produces authorDateSeconds * 1000 (milliseconds), and mobile-git-history.ts then did nowMs - timestampSeconds * 1000.

Our own test encoded the wrong unit (timestamp: NOW / 1000 - 3600), so it passed green while production was broken. The upstream patch corrects code and test together — which is why this one is worth taking as-is rather than hand-fixing the multiply.

The two walks

2ccf35b135 — an anchored + makes the engine backtrack across the padding run for every start position it tries, so a row a TUI padded to the window width costs quadratic time, and a fullscreen redraw trims every retained row per frame. Nothing needed importing: our trimTerminalLineRight (orca-runtime.ts:39163) already walks the string and is identical to upstream's — those two call sites simply never used it. Upstream's test is not brought: it imports two modules extracted after our divergence, and our helper is private to the monolith.

373a670aba — this runs once per PTY chunk, on the main thread, for every terminal, visible or not. Only ESC can introduce a vertical control, so for ordinary output the whole walk is wasted. Ours was slower than upstream's pre-fix version: it read value[index], minting a one-character string per position. Now it jumps ESC to ESC with indexOf, keeping the parsed.endIndex skip in the body.

Both perf numbers in those commit messages are upstream's measurements, not mine — what I verified here is that the code paths are ours and that behaviour is unchanged.

Tests

4554 src/main/runtime, 4305 terminal-pane, 194 mobile source-control. Gates: max-lines OK, check:test-case-deletion OK (61786 cases, none lost).

nwparker and others added 4 commits September 9, 2026 11:21
Cold restore seeded a checkpoint's OSC-8 link ranges and then replayed records
that resize, so any resize record after the checkpoint dropped them and
restored hyperlinks in scrollback lost clickability. Same-size resize records
reach the durable log routinely, because every attach re-asserts the pane's
dimensions and session-output-plane records each one without a same-size
dedupe — so an ordinary reattach was enough to lose the links.

Restored ranges are row-indexed, so clearing them on a reflow is right; a
resize to the size already applied is not a reflow. Gate on the dimensions
actually changing.

Introduced in d46349c ("fix: improve mobile link modifier handling",
#5597), which added setRestoredOscLinks along with unconditional clearing in
both resize() and clearScrollback(). clearScrollback's clearing is correct and
is unchanged, with a test pinning it.

Found during adversarial review of #17752 and filed as #17756. Not a
regression from that PR: #17667 had incidentally masked it by gating no-op
resizes to protect a snapshot cache, and removing the cache removed the gate.
The same gate returns here on its own terms — as a correctness fix with tests,
rather than as a side effect of a cache.

(cherry picked from commit ae35e04)
…17731)

Co-authored-by: Claude <[email protected]>
Co-authored-by: Jinwoo-H <[email protected]>
(cherry picked from commit c300913)
…pstream #19214)

Port de la idea de stablyai/orca#19214. Dos call sites del redraw seguian con
`line.replace(/[ \t]+$/g, '')`: el `+` anclado hace que el motor retroceda sobre
la corrida de padding por cada posicion de inicio que prueba, o sea tiempo
cuadratico en una fila que un TUI rellena hasta el ancho de la ventana. Y un
redraw a pantalla completa trimea CADA fila retenida en cada frame.

No hace falta traer nada: nuestro `trimTerminalLineRight` (orca-runtime.ts:39163)
ya camina la cadena y es identico al de upstream, solo que esos dos sitios nunca
lo usaron. El diff son dos lineas.

El test de upstream no se trae: importa `terminal-tail-buffer` y
`terminal-tail-line-controls`, dos modulos que extrajo despues de nuestra
divergencia, y nuestro helper es privado del monolito. Sin cambio de
comportamiento —las dos implementaciones son equivalentes, leidas lado a lado— y
los 4554 tests de `src/main/runtime` que cubren ese camino siguen verdes. La
medicion de la mejora es de upstream, no mia.
…eam #19400)

Port de stablyai/orca#19400 a nuestro monolito.
`containsTerminalVerticalLineControl` corre una vez por chunk de PTY, en el main
thread, para CADA terminal —visible, oculta o aparcada— y caminaba la cadena
posicion por posicion. Solo un ESC puede introducir un control vertical, asi que
para salida ordinaria (logs de build, `cat`, texto por pipe) el walk entero es
trabajo tirado.

Nuestra version era incluso mas lenta que la de upstream ANTES de su fix: leia
`value[index]`, que crea un string de un caracter por posicion. Ahora salta con
`indexOf` de ESC en ESC, conservando el skip de `parsed.endIndex` en el cuerpo.

4554 tests de `src/main/runtime` en verde, sin cambio de comportamiento.
@fabolivark
fabolivark merged commit 87c40cf into main Sep 9, 2026
47 of 48 checks passed
@fabolivark
fabolivark deleted the feat/upstream-batch-4 branch September 9, 2026 17:20
github-actions Bot pushed a commit that referenced this pull request Oct 15, 2026
…ntries (#28990)

* fix(layout): drop the pre-tab-bar session migration; orphan adoption writes tab-bar entries

The window and main's Loader now both ignore sessions saved before the tab bar (pre-#371).
Orphan adoption, the one present-day writer that saved terminal rows without tab-bar
entries, now writes them through the shared serializer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test: drop the pre-tab-bar case from terminal tab id hydration

It exercised only the deleted converter; the tab-bar case above covers the live rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants