Fix hidden delivery startup gate helper

This commit is contained in:
Neil
2026-06-16 17:16:22 -07:00
parent e5a84717f5
commit 712f93024a
@@ -358,6 +358,7 @@ function containsHiddenStartupRendererQuery(data: string): boolean {
const HIDDEN_STARTUP_RENDERER_QUERY_PENDING_CHARS = 64
const HIDDEN_STARTUP_OSC_COLOR_QUERY_PREFIXES = ['\x1b]10;?', '\x1b]11;?'] as const
const HIDDEN_STARTUP_RENDERER_QUERY_WINDOW_MS = 10_000
function findOscTerminatorIndex(data: string, offset: number): number {
for (let index = offset; index < data.length; index++) {
@@ -2386,6 +2387,9 @@ export function connectPanePty(
let foregroundImmediateBudgetWindowStart = 0
let hiddenMode2031ScanTail = ''
const shouldSnapshotHiddenCodexOutput = shouldKeepHiddenStartupRendererQueriesLive(paneStartup)
const hiddenStartupRendererQueryWindowEndsAt = shouldSnapshotHiddenCodexOutput
? Date.now() + HIDDEN_STARTUP_RENDERER_QUERY_WINDOW_MS
: 0
let hiddenStartupRendererQueryPending = ''
function canUseMainBufferSnapshot(ptyId: string | null): ptyId is string {
@@ -2419,10 +2423,11 @@ export function connectPanePty(
return transport.serializeBuffer(opts)
}
function isHiddenStartupRendererQueryWindowActive(): boolean {
function isHiddenStartupDeliveryGateHoldActive(): boolean {
return (
shouldSnapshotHiddenCodexOutput &&
!shouldWritePtyOutputForeground(deps.isVisibleRef.current)
!shouldWritePtyOutputForeground(deps.isVisibleRef.current) &&
Date.now() <= hiddenStartupRendererQueryWindowEndsAt
)
}
@@ -2501,7 +2506,7 @@ export function connectPanePty(
!shouldWritePtyOutputForeground(deps.isVisibleRef.current) &&
// Why: codex startup probes need the live xterm to answer renderer
// queries for 10s — never gate delivery while the window is active.
!isHiddenStartupRendererQueryWindowActive()
!isHiddenStartupDeliveryGateHoldActive()
const isFirstSyncForPty = hiddenDeliverySyncedPtyId !== ptyId
hiddenDeliverySyncedPtyId = ptyId
if (shouldHide) {
@@ -3430,14 +3435,14 @@ export function connectPanePty(
const shouldSkipHiddenOutput =
hiddenMode2031Candidate ||
shouldSkipHiddenRendererOutput({
foreground,
canRestoreHiddenOutput,
startupRendererQueryWindowActive:
hiddenStartupRendererQueryWindowActive && !hiddenMode2031Candidate,
synchronizedOutputActive: synchronizedHiddenOutput,
allowSynchronizedModelRestore: true,
data
})
foreground,
canRestoreHiddenOutput,
startupRendererQueryWindowActive:
hiddenStartupRendererQueryWindowActive && !hiddenMode2031Candidate,
synchronizedOutputActive: synchronizedHiddenOutput,
allowSynchronizedModelRestore: true,
data
})
if (shouldSkipHiddenOutput && !splitSynchronizedBoundary) {
skipHiddenRendererOutput(data)
} else if (synchronizedHiddenOutput) {