Detach retained CI and terminal tails from oversized strings (#20960)

* fix(memory): detach retained CI and terminal tails from oversized strings

* fix(terminal): detach retained error and reattach string slices

* fix(terminal): release oversized recent-output backing strings

* fix(terminal): release backing strings held by PTY detectors

* fix(memory): own bounded Claude background task labels

* fix: detach retained terminal mode scan tails

* fix: own retained plugin worker output strings

* fix: own incomplete OSC 133 carry strings

---------

Co-authored-by: m4air <m4air@Mac.localdomain>
Co-authored-by: m4air <m4air@m4airs-MacBook-Air.local>
This commit is contained in:
OrcaWin
2026-09-17 20:34:19 -07:00
committed by GitHub
co-authored by m4air m4air
parent 57e28ccf7c
commit d04b05b5c8
57 changed files with 9130 additions and 18 deletions
@@ -1,4 +1,5 @@
import type { Readable } from 'node:stream'
import { ownRetainedString } from '../../shared/own-retained-string'
type PluginWorkerOutputSink = (level: 'info' | 'warn' | 'error', line: string) => void
@@ -21,9 +22,11 @@ export function pipePluginWorkerOutput(
if (line.trim().length > 0) {
log(
level,
truncated
? `${line.slice(0, PLUGIN_WORKER_OUTPUT_LINE_LIMIT - TRUNCATION_SUFFIX.length)}${TRUNCATION_SUFFIX}`
: line
ownRetainedString(
truncated
? `${line.slice(0, PLUGIN_WORKER_OUTPUT_LINE_LIMIT - TRUNCATION_SUFFIX.length)}${TRUNCATION_SUFFIX}`
: line
)
)
}
}
@@ -49,7 +52,7 @@ export function pipePluginWorkerOutput(
buffered = ''
discarding = newline === -1
} else {
buffered += segment
buffered += newline === -1 ? ownRetainedString(segment) : segment
if (newline !== -1) {
emit(buffered)
buffered = ''