diff --git a/test/helpers/claude-pty-runner.ts b/test/helpers/claude-pty-runner.ts index 3b56fb07..ac9c7f07 100644 --- a/test/helpers/claude-pty-runner.ts +++ b/test/helpers/claude-pty-runner.ts @@ -133,22 +133,34 @@ export function isTrustDialogVisible(visible: string): boolean { return visible.includes('trust this folder'); } -/** Detect plan-mode's native "ready to execute" confirmation. */ +/** + * Detect plan-mode's native "ready to execute" confirmation. Tests both the + * spaced and whitespace-collapsed forms because stripAnsi removes cursor- + * positioning escapes (e.g. `\x1b[40C`) that render visually as spaces but + * leave no character behind — so "ready to execute" can come through as + * "readytoexecute" depending on the rendering path. + */ export function isPlanReadyVisible(visible: string): boolean { - return /ready to execute|Would you like to proceed/i.test(visible); + if (/ready to execute|Would you like to proceed/i.test(visible)) return true; + const collapsed = visible.replace(/\s+/g, ''); + return /readytoexecute|Wouldyouliketoproceed/i.test(collapsed); } /** * Detect the AUTO_DECIDE preamble template firing. The model prints * "Auto-decided