fix: pr-bug-scan validated finding from #4669#4740
Open
buf0-bot[bot] wants to merge 1 commit into
Open
Conversation
Decay per-pane synchronizedForegroundOutputActive closure flag after 1s without an end marker; blocks the latch-stuck path that pinned later foreground writes on the scheduler 250ms hold.
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — adds a 1-second timeout on the per-pane synchronized-output latch so a TUI that emits \x1b[?2026h and then dies without the matching end marker cannot pin every subsequent foreground write on the scheduler's 250 ms hold path for the lifetime of the pane.
- Add
SYNCHRONIZED_FOREGROUND_OUTPUT_ACTIVE_MAX_MS(1000 ms) — ceiling on the per-pane DEC 2026 latch; longer than any legitimate synchronized frame, short enough to recover within ~1 s. - Track
synchronizedForegroundOutputActiveSince—Date.now()timestamp set on false→true transition, cleared on true→false (or decay). - Force-decay in
writePtyOutputToXterm— after computingnextSynchronizedForegroundOutputActive, if it's still active and has exceeded the max, set it tofalsesoholdForegroundroutes the chunk normally.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Automated fix-PR from pr-bug-scan for parent #4669.
Fixer status:
FIXED_WITH_CODE_PROOFSummary: Decay per-pane synchronizedForegroundOutputActive closure flag after 1s without an end marker; blocks the latch-stuck path that pinned later foreground writes on the scheduler 250ms hold.
Blocked proof link:
src/renderer/src/components/terminal-pane/pty-connection.ts:1860-1868Typecheck:
skippedProof (from validator)
code_analysis\x1b[?2026hin a foreground chunk and then is killed/crashes/never emits\x1b[?2026l. After the safety timer drains the held bytes, any later foreground PTY chunk arrives.let synchronizedForegroundOutputActive = falseper pty-connection (per-pane closure)shouldSynchronizedOutputRemainActivereturnswasActiveunchanged when neither marker appears in the chunk — no decaynextSynchronizedForegroundOutputActive = shouldSynchronizedOutputRemainActive(data, synchronizedForegroundOutputActive)then assigns it back to the closure variable; once true with an unmatched start, it stays true on every later chunk that lacks markersholdForeground: synchronizedForegroundOutput && nextSynchronizedForegroundOutputActivetowriteTerminalOutputforegroundHold = true, and callsscheduleForegroundHoldSafetywhich delays drain by FOREGROUND_HOLD_SAFETY_DELAY_MS (250 ms)Generated by
pr-bug-scan(proof-machine architecture). Human approval required before merge.