From dd354e213420f1992a23953f87e3cc4b84eb8638 Mon Sep 17 00:00:00 2001 From: Michael Bolin Date: Tue, 13 May 2025 12:01:06 -0700 Subject: [PATCH] fix: remember to set lastIndex = 0 on shared RegExp (#918) I had not observed an issue in the wild because of this yet, but it feels like it was only a matter of time... --- codex-cli/src/components/chat/terminal-chat-response-item.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/codex-cli/src/components/chat/terminal-chat-response-item.tsx b/codex-cli/src/components/chat/terminal-chat-response-item.tsx index 90c188aa..888547a6 100644 --- a/codex-cli/src/components/chat/terminal-chat-response-item.tsx +++ b/codex-cli/src/components/chat/terminal-chat-response-item.tsx @@ -330,6 +330,7 @@ function rewriteFileCitations( return markdown; } + citationRegex.lastIndex = 0; return markdown.replace(citationRegex, (_match, file, start, _end) => { const absPath = path.resolve(cwd, file); const uri = `${fileOpener}://file${absPath}:${start}`;