diff --git a/src/renderer/src/components/terminal-pane/pty-parked-delivery-debt.ts b/src/renderer/src/components/terminal-pane/pty-parked-delivery-debt.ts index 0907d1b78af..89e10bdfbc3 100644 --- a/src/renderer/src/components/terminal-pane/pty-parked-delivery-debt.ts +++ b/src/renderer/src/components/terminal-pane/pty-parked-delivery-debt.ts @@ -6,7 +6,9 @@ * call a wedge, so it was blind by construction, and the producer was never paused — main * kept flooding a pane nobody could see. Holding the credit turns parked bytes into real * debt, which is what makes main's existing per-PTY window pause the shell, the watchdog - * see the pane, and the write-off lane able to forgive it. + * see the pane, and the write-off lane able to forgive it. The pause is not guaranteed: this + * buffer caps at 512KB of UTF-8 BYTES while main's window counts UTF-16 CHARS, so on + * multi-byte output eviction settles the credit before main's window ever fills. * * Unit is delivery-credit CHARS (`rawLength ?? data.length`), never the buffer's UTF-8 byte diff --git a/src/shared/pty-renderer-delivery-health.ts b/src/shared/pty-renderer-delivery-health.ts index 0b92a62e707..a644ce096bf 100644 --- a/src/shared/pty-renderer-delivery-health.ts +++ b/src/shared/pty-renderer-delivery-health.ts @@ -19,8 +19,11 @@ export type PtyRendererDeliveryStateReport = { * ACK path and resync response carry; merging them here is a free extra * repair lane for the lost-ACK variant. */ processedCharsByPty: Record - /** Cumulative chars received for a PTY that has no registered data handler and - * are parked in the renderer's pre-handler buffer. Their ACK is withheld, so — + /** Chars CURRENTLY parked for a PTY with no registered data handler — a live balance, + * decremented as each chunk settles, not a cumulative total like the fields either side + * of it. `writeOffLostRendererDelivery` subtracts it from a cumulative `receivedChars` + * precisely because of that: what is still parked is what cannot repay itself. Their ACK + * is withheld, so — * unlike received-but-unparsed bytes, which their own deferred ACK repays — * this debt has no consumer to repay it and only a write-off or a bind clears * it. Absent means "none parked", which is exactly how an older renderer read. */