Repository navigation
VSCode extension: open-in-targets error loop causes high CPU (Code Helper Renderer 100%+) #16849
Description
Summary
The openai.chatgpt VS Code extension (Codex) has a bug where the open-in-targets and set-preferred-app handlers throw an error instead of returning gracefully. Because the webview queries open-in-targets on a 1-minute interval (staleTime: ONE_MINUTE), the failure triggers a React Query retry loop, resulting in continuous log spam and sustained 100-170% CPU usage on Code Helper (Renderer) processes.
This happens in every open VS Code window that has the Codex panel loaded.
Affected versions
26.325.31654-darwin-arm6426.5401.11717(latest as of 2026-04-05)
Evidence
VS Code extension logs rotate 6+ times within a single session:
~/.vscode/Code/logs/.../exthost/openai.chatgpt/Codex.1.log (1,556 lines)
~/.vscode/Code/logs/.../exthost/openai.chatgpt/Codex.2.log (1,556 lines)
~/.vscode/Code/logs/.../exthost/openai.chatgpt/Codex.3.log (1,556 lines)
~/.vscode/Code/logs/.../exthost/openai.chatgpt/Codex.4.log (1,556 lines)
~/.vscode/Code/logs/.../exthost/openai.chatgpt/Codex.5.log (1,556 lines)
~/.vscode/Code/logs/.../exthost/openai.chatgpt/Codex.6.log (1,556 lines)
Repeated error:
Error: open-in-target not supported in extension
at open-in-targets (extension.js:255:22561)
at W_.handleVSCodeRequest (extension.js:255:27618)
at Qw.fetch (extension.js:214:1973)
...
Activity Monitor during the loop:
Code Helper (Renderer) 171.1% CPU
Code Helper (Renderer) 112.4% CPU
Code Helper (Plugin) 31.6% CPU
Root cause
In extension.js, both handlers are intentional stubs for features unsupported in extension mode, but they throw instead of returning gracefully:
// extension.js (both 26.325.31654 and 26.5401.11717)
"open-in-targets": async () => {
throw new Error("open-in-target not supported in extension")
},
"set-preferred-app": async () => {
throw new Error("open-in-target not supported in extension")
},The webview (index-*.js) queries open-in-targets via React Query with staleTime: ONE_MINUTE:
queryFn: async () => pr(`open-in-targets`, { params: { cwd: e } }),
queryKey: Sr(`open-in-targets`, { cwd: e }),
staleTime: Fr.ONE_MINUTEWhen the query throws, React Query retries, creating a continuous failure loop.
Requested fix
Return an empty/no-op response instead of throwing, so the webview treats the feature as unavailable without retrying:
"open-in-targets": async () => ({ targets: [] }),
"set-preferred-app": async () => ({}),This makes the behavior consistent with other unsupported stubs in the extension and stops the retry loop entirely. The fix is a one-liner in the extension source, no functional change, just converting an unhandled throw into a graceful empty response.
Activity
ofrnsb commentedon Apr 5, 2026
cc @bolinfest @jif-oai @aibrahim-oai @nornagon-openai @dylan-hurd-oai @charley-oai — tagging core contributors, this affects the VS Code extension specifically.
github-actions commentedon Apr 5, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
open-in-targetfailure loop in extension #16320Powered by Codex Action
MingLi3306 commentedon Apr 5, 2026
I've encountered the same problem.
After using the latest version of the CodeX vs Code extension and having several conversations with CodeX,
my Macbook Air M4's CPU usage exceeded 100%, and the computer overheated significantly.
ofrnsb commentedon Apr 5, 2026
run this script to fix it
bagerxx commentedon Apr 5, 2026
I believe I was seeing the same issue.
When Codex was active in VS Code,
Code Helper (Renderer)was reaching around 200% CPU and my Mac was overheating very quickly. Your root-cause analysis matches my symptoms closely.Thank you for identifying and documenting this so clearly.
I applied the patch script shared in this thread, reloaded VS Code, and after that the abnormal CPU and overheating behavior stopped on my side. I tested it several times and the issue no longer seems to occur, although I will continue testing.
Ga1axy0 commentedon Apr 5, 2026
Thanks a lot to identifying and solving the problem. After using the script, the behavior of the CPU over usage seems disappear.
Moreover, thanks to @bagerxx for leading me to see this solution.
9426224 commentedon Apr 6, 2026
Thanks a lot, this patch really works on M1 Max macOS 2.6.
MingLi3306 commentedon Apr 6, 2026
Thank you for your help.
MingLi3306 commentedon Apr 6, 2026
Thank you for your help.
KeriaGuma commentedon Apr 7, 2026
Thanks for the investigation.
I applied the workaround locally on macOS by changing:
"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")},"set-preferred-app":async()=>{throw new Error("open-in-target not supported in extension")},to:
"open-in-targets":async()=>({targets:[]}),"set-preferred-app":async()=>({}),After restarting VS Code, Codex loaded normally and the high CPU / overheating issue disappeared.
Really appreciate you sharing this.
bwesen commentedon Apr 8, 2026
Great find, I had to kill VSCode after every prompt in the Codex plugin because of the 100% CPU
Smexey commentedon Apr 8, 2026
Little script i made that fixes it since any manual fixes break on update:
12 remaining items
ofrnsb commentedon Apr 14, 2026
thanks @shijie-oai!
you might want to see another cases as well, will describe it here later.
Dagsi commentedon Apr 16, 2026
Hi, thanks for the update.
Do you have an estimated timeline for when the next release will be rolled out? The current issue is blocking us from using the feature, so it’s quite urgent on our side.
Appreciate your help!
tinkeridze commentedon Apr 16, 2026
Hello everyone!! Will running the fix script affect the extension's functionality in the future? What happens to the changes after the update? Will I need to do anything to undo all the changes made by the script?
Or does anyone have information on how often they release?)
Thank you for sharing, investigating, and resolving this issue.
shijie-oai commentedon Apr 16, 2026
Hi all! We should be releasing a VSCE version soon - I will post back when the version is updated.
tinkeridze commentedon Apr 16, 2026
The latest update made it even worse 😭
(93 °C – average core temperature . Its 199 °F)
Are there any ways to help troubleshoot this? I can share system logs or something
ofrnsb commentedon Apr 17, 2026
i will maintain it and publish a GitHub repo so people can clone and run it instead of waiting on OpenAI to fix it.
ofrnsb commentedon Apr 17, 2026
this script still works.
Ga1axy0 commentedon Apr 17, 2026
Does it work or not?
Ga1axy0 commentedon Apr 17, 2026
Does the newest version 26.415.20818 solved this issue? Same problem happened when I using the codex extention.
ofrnsb commentedon Apr 18, 2026
hmmm, it does work on my machine
ofrnsb commentedon Apr 18, 2026
update to 26.5409.20454 using VSIX then run that script. works perfectly
Ga1axy0 commentedon Apr 20, 2026
26.5415.20818 is the newest version, and it seems like remove the parameter used in the script, which cause the failure of it.
nicohouillon commentedon Apr 22, 2026
My cpu was about 130% with 417 (or 5417 pre release) , I tried the patch but didnt work :
Then I downgraded to .409. and applied the patch, but perf got even worse (300%)
The script doesnt fix the problem unfortunately
nkawli commentedon Apr 23, 2026
+1
ofrnsb commentedon Apr 23, 2026
that's the pain-point with personal patch, it only works on specific circumstance, in this case, mine.