Lightweight coding agent that runs in your terminal
Rust
bugfix: remove redundant thinking updates and put a thinking timer above the prompt instead (#216)
Scott Leibrand4386dfc67b8c
diff --git a/codex-cli/src/components/chat/terminal-chat-response-item.tsx b/codex-cli/src/components/chat/terminal-chat-response-item.tsxindex 8e7ab4d8eb..4b7e069ff4 100644--- a/codex-cli/src/components/chat/terminal-chat-response-item.tsx+++ b/codex-cli/src/components/chat/terminal-chat-response-item.tsx@@ -72,30 +72,13 @@ export function TerminalChatResponseReasoning({}: {message: ResponseReasoningItem & { duration_ms?: number };}): React.ReactElement | null {- // prefer the real duration if present- const thinkingTime = message.duration_ms- ? Math.round(message.duration_ms / 1000)- : Math.max(- 1,- Math.ceil(- (message.summary || [])- .map((t) => t.text.length)- .reduce((a, b) => a + b, 0) / 300,- ),- );- if (thinkingTime <= 0) {+ // Only render when there is a reasoning summary+ if (!message.summary || message.summary.length === 0) {return null;}-return (<Box gap={1} flexDirection="column">- <Box gap={1}>- <Text bold color="magenta">- thinking- </Text>- <Text dimColor>for {thinkingTime}s</Text>- </Box>- {message.summary?.map((summary, key) => {+ {message.summary.map((summary, key) => {const s = summary as { headline?: string; text: string };return (<Box key={key} flexDirection="column">diff --git a/codex-cli/src/components/chat/terminal-message-history.tsx b/codex-cli/src/components/chat/terminal-message-history.tsxindex 0e28359135..07c3ac3762 100644--- a/codex-cli/src/components/chat/terminal-message-history.tsx+++ b/codex-cli/src/components/chat/terminal-message-history.tsx@@ -30,16 +30,14 @@ const MessageHistory: React.FC<MessageHistoryProps> = ({thinkingSeconds,fullStdout,}) => {- const [messages, debug] = useMemo(- () => [batch.map(({ item }) => item!), process.env["DEBUG"]],- [batch],- );+ // Flatten batch entries to response items.+ const messages = useMemo(() => batch.map(({ item }) => item!), [batch]);return (<Box flexDirection="column">- {loading && debug && (+ {loading && (<Box marginTop={1}>- <Text color="yellow">{`(${thinkingSeconds}s)`}</Text>+ <Text color="yellow">{`thinking for ${thinkingSeconds}s`}</Text></Box>)}<Static items={["header", ...messages]}>@@ -48,8 +46,13 @@ const MessageHistory: React.FC<MessageHistoryProps> = ({return <TerminalHeader key="header" {...headerProps} />;}- // After the guard above `item` can only be a ResponseItem.+ // After the guard above, item is a ResponseItemconst message = item as ResponseItem;+ // Suppress empty reasoning updates (i.e. items with an empty summary).+ const msg = message as unknown as { summary?: Array<unknown> };+ if (msg.summary?.length === 0) {+ return null;+ }return (<Boxkey={`${message.id}-${index}`}