From 09f0ae3899910995ac9659504739e16363d7176c Mon Sep 17 00:00:00 2001 From: Mitchell Kutchuk Date: Mon, 21 Apr 2025 15:01:09 -0400 Subject: [PATCH] fix: unintended tear down of agent loop (#483) fixes #465 --- codex-cli/src/components/chat/terminal-chat.tsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/codex-cli/src/components/chat/terminal-chat.tsx b/codex-cli/src/components/chat/terminal-chat.tsx index 85582080..4859513a 100644 --- a/codex-cli/src/components/chat/terminal-chat.tsx +++ b/codex-cli/src/components/chat/terminal-chat.tsx @@ -305,15 +305,10 @@ export default function TerminalChat({ agentRef.current = undefined; forceUpdate(); // re‑render after teardown too }; - }, [ - model, - provider, - config, - approvalPolicy, - confirmationPrompt, - requestConfirmation, - additionalWritableRoots, - ]); + // We intentionally omit 'approvalPolicy' and 'confirmationPrompt' from the deps + // so switching modes or showing confirmation dialogs doesn’t tear down the loop. + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [model, provider, config, requestConfirmation, additionalWritableRoots]); // Whenever loading starts/stops, reset or start a timer — but pause the // timer while a confirmation overlay is displayed so we don't trigger a