From 2cf8299fd49c20c28979523bb421551107f5309a Mon Sep 17 00:00:00 2001 From: Mahima Shanware Date: Wed, 6 May 2026 05:53:15 +0000 Subject: [PATCH] chore: optimize SIGWINCH vision and recovery logic --- .gitignore | 1 + packages/cli/src/services/UserSimulator.ts | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 85902b4a7c..4e518bc3c7 100644 --- a/.gitignore +++ b/.gitignore @@ -68,3 +68,4 @@ temp_agents/ # conductor extension and planning directories conductor/ +simulator_workspace_* diff --git a/packages/cli/src/services/UserSimulator.ts b/packages/cli/src/services/UserSimulator.ts index c9ceb5e5a8..9ce31f045b 100644 --- a/packages/cli/src/services/UserSimulator.ts +++ b/packages/cli/src/services/UserSimulator.ts @@ -122,8 +122,9 @@ export class UserSimulator { // (e.g. ANSI clear/repaint sequences) before looking at the screen. // Increased to 1s to handle high-latency PTYs in Docker. // Force a terminal repaint by sending SIGWINCH to the current process. - process.kill(process.pid, "SIGWINCH"); - await new Promise((resolve) => setTimeout(resolve, 1000)); + debugLogger.log('[SIMULATOR] Sending SIGWINCH to process group to force repaint.'); + try { process.kill(0, 'SIGWINCH'); } catch (_e) { process.kill(process.pid, 'SIGWINCH'); } + await new Promise((resolve) => setTimeout(resolve, 1500)); const screen = this.getScreen(); if (!screen) return; @@ -176,8 +177,8 @@ export class UserSimulator { // RECOVERY: If screen is blank and we are stalled, try a terminal refresh. if (normalizedScreen.length === 0 && this.pendingToolCalls.length > 0) { - debugLogger.log('[SIMULATOR] Screen is blank but system is BLOCKED. Sending refresh carriage return.'); - this.stdinBuffer.write('\r'); + debugLogger.log('[SIMULATOR] Screen is blank but system is BLOCKED. Sending SIGWINCH refresh.'); + try { process.kill(0, 'SIGWINCH'); } catch (_e) { process.kill(process.pid, 'SIGWINCH'); } return; } } else {