mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-09 00:49:41 +02:00
fix: multi-layer backpressure to prevent terminal write freezes
Add three layers of protection against oversized terminal.write() calls that freeze Chrome's main thread: 1. SSE entry cap: _onSessionTerminal drops data when total queued bytes (pendingWrites + flickerFilterBuffer) exceeds 128KB. Server sends session:needsRefresh to recover dropped content. 2. Flush cap: flushPendingWrites splits at DEC 2026 sync segment boundaries with 64KB per-frame budget. Excess segments deferred to next requestAnimationFrame. Segment-level splitting preserves Ink redraw atomicity (no flicker). 3. Reduced tail size: initial buffer fetch reduced to 128KB (from 256KB) to limit data volume during tab switch. Re-enable WebGL renderer — root cause was unbounded terminal.write() volume, not the GPU renderer itself. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -52,8 +52,8 @@ const TITLE_FLASH_INTERVAL_MS = 1500; // Title flash rate
|
||||
const BROWSER_NOTIF_RATE_LIMIT_MS = 3000; // Rate limit for browser notifications
|
||||
const AUTO_CLOSE_NOTIFICATION_MS = 8000; // Auto-close browser notifications
|
||||
const THROTTLE_DELAY_MS = 100; // General UI throttle delay
|
||||
const TERMINAL_CHUNK_SIZE = 32 * 1024; // 32KB chunks for terminal data (smaller to avoid WebGL GPU stalls)
|
||||
const TERMINAL_TAIL_SIZE = 256 * 1024; // 256KB tail for initial load
|
||||
const TERMINAL_CHUNK_SIZE = 32 * 1024; // 32KB chunks for terminal buffer loading
|
||||
const TERMINAL_TAIL_SIZE = 128 * 1024; // 128KB tail for initial load
|
||||
const SYNC_WAIT_TIMEOUT_MS = 50; // Wait timeout for terminal sync
|
||||
const STATS_POLLING_INTERVAL_MS = 2000; // System stats polling
|
||||
|
||||
|
||||
Reference in New Issue
Block a user