Redact PTY IDs in pending data drop diagnostics

Prevent workspace paths embedded in session IDs from leaking through
diagnostic logs by using redactPtyIdForDiagnostics.
This commit is contained in:
Jinjing
2026-08-24 13:36:18 -07:00
parent e2e90ad226
commit 3bf79c592e
2 changed files with 3 additions and 4 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ import {
scanMode2031ReplyDecision,
type Mode2031ReplyScanState
} from '../../../../shared/terminal-color-scheme-protocol'
import { redactPtyIdForDiagnostics } from '../../../../shared/pty-delivery-diagnostics'
import { recordCrashBreadcrumb } from '../../../crash-reporting/crash-breadcrumb-store'
import { terminalOutputBacklogCapChars } from '../../../../shared/terminal-scrollback-policy'
import { isHiddenPtyDeliveryGateEnabled } from '../../pty-hidden-delivery-gate'
@@ -97,7 +98,7 @@ export function dropOversizedPendingPtyData(
if (!session.pendingDataDropWarnedPtys.has(id)) {
session.pendingDataDropWarnedPtys.add(id)
console.error(
`[pty] dropped ${pending.data.length} buffered chars for ${id}: renderer not receiving and per-PTY pending cap exceeded; pane will restore from the main-owned snapshot`
`[pty] dropped ${pending.data.length} buffered chars for ${redactPtyIdForDiagnostics(id)}: renderer not receiving and per-PTY pending cap exceeded; pane will restore from the main-owned snapshot`
)
// Why: field visibility for cap tuning (issue #2836 / #7017); no pty id since session ids can embed workspace paths.
recordCrashBreadcrumb('terminal_pending_output_dropped', {
+1 -3
View File
@@ -64,9 +64,7 @@ export async function commitPtyIpcSpawn(ctx: PtyIpcSpawnState): Promise<PtySpawn
}
)
} else if (typeof ctx.result.replay === 'string' && ctx.result.replay.length > 0) {
// Why: the relay reattach replay is the one restore main never ingests, so without
// this seed its model is a mere suffix of what the renderer painted — and a later
// park-reveal would outrank the fuller relay replay with that fragment.
// Why: relay reattach replay is the only restore main never ingests; skip this seed and park-reveal would replace it with a suffix fragment.
ctx.deps.runtime.seedHeadlessTerminal(ctx.result.id, ctx.result.replay)
}
}