VSCode extension: open-in-targets error loop causes high CPU (Code Helper Renderer 100%+)

Resolved 💬 34 comments Opened Apr 5, 2026 by ofrnsb Closed Apr 13, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

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-arm64
  • 26.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_MINUTE

When 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.

View original on GitHub ↗

33 Comments

ofrnsb · 3 months ago

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[bot] contributor · 3 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #16320
  • #15397
  • #15958

Powered by Codex Action

MingLi3306 · 3 months ago

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 · 3 months ago
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.

run this script to fix it

set -euo pipefail

EXT_DIR="$HOME/.vscode/extensions"
PATCHED=0
SKIPPED=0
ALREADY=0

find "$EXT_DIR" -maxdepth 1 -type d -name "openai.chatgpt-*" | sort | while read -r dir; do
  ext_js="$dir/out/extension.js"
  version=$(basename "$dir")

  if [[ ! -f "$ext_js" ]]; then
    echo "[$version] extension.js not found, skipping"
    continue
  fi

  # Check if bug is present
  if grep -q '"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}' "$ext_js"; then
    echo "[$version] bug detected — patching..."

    # Backup (only once per version)
    if [[ ! -f "$ext_js.bak" ]]; then
      cp "$ext_js" "$ext_js.bak"
      echo "[$version] backup created: extension.js.bak"
    fi

    sed -i '' \
      's/"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}/"open-in-targets":async()=>({targets:[]})/g' \
      "$ext_js"

    sed -i '' \
      's/"set-preferred-app":async()=>{throw new Error("open-in-target not supported in extension")}/"set-preferred-app":async()=>({})/g' \
      "$ext_js"

    # Verify
    if grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then
      echo "[$version] patched successfully"
    else
      echo "[$version] patch verification failed — restoring backup"
      cp "$ext_js.bak" "$ext_js"
    fi

  elif grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then
    echo "[$version] already patched, skipping"
  else
    echo "[$version] open-in-targets pattern not found — extension structure may have changed"
  fi
done

echo ""
echo "Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window"
Ga1axy0 · 3 months ago

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 · 3 months ago
> I've encountered the same problem.我也遇到过同样的问题。 > After using the latest version of the CodeX vs Code extension and having several conversations with CodeX,在使用最新版本的 CodeX vs Code 扩展程序并与 CodeX 进行多次沟通后, > my Macbook Air M4's CPU usage exceeded 100%, and the computer overheated significantly.我的 Macbook Air M4 的 CPU 使用率超过 100%,电脑严重过热。 run this script to fix it运行此脚本即可修复它 `` set -euo pipefail EXT_DIR="$HOME/.vscode/extensions" PATCHED=0 SKIPPED=0 ALREADY=0 find "$EXT_DIR" -maxdepth 1 -type d -name "openai.chatgpt-*" | sort | while read -r dir; do ext_js="$dir/out/extension.js" version=$(basename "$dir") if [[ ! -f "$ext_js" ]]; then echo "[$version] extension.js not found, skipping" continue fi # Check if bug is present if grep -q '"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}' "$ext_js"; then echo "[$version] bug detected — patching..." # Backup (only once per version) if [[ ! -f "$ext_js.bak" ]]; then cp "$ext_js" "$ext_js.bak" echo "[$version] backup created: extension.js.bak" fi sed -i '' \ 's/"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}/"open-in-targets":async()=>({targets:[]})/g' \ "$ext_js" sed -i '' \ 's/"set-preferred-app":async()=>{throw new Error("open-in-target not supported in extension")}/"set-preferred-app":async()=>({})/g' \ "$ext_js" # Verify if grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then echo "[$version] patched successfully" else echo "[$version] patch verification failed — restoring backup" cp "$ext_js.bak" "$ext_js" fi elif grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then echo "[$version] already patched, skipping" else echo "[$version] open-in-targets pattern not found — extension structure may have changed" fi done echo "" echo "Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window" ``

Thanks a lot, this patch really works on M1 Max macOS 2.6.

MingLi3306 · 3 months ago
> > 我也遇到过同样的问题。 > > 在使用最新版本的CodeX vs Code扩展并与CodeX进行多次对话后,在使用最新版本的CodeX vs Code扩展程序并与CodeX进行多次沟通后, > > 我的Macbook Air M4的CPU使用率超过100%,计算机明显过热。我的Macbook Air M4的CPU使用率超过100%,计算机严重过热。 > > > 运行此脚本来修复它运行此脚本即可修复它 > `` > set -euo pipefail > > EXT_DIR="$HOME/.vscode/extensions" > PATCHED=0 > SKIPPED=0 > ALREADY=0 > > find "$EXT_DIR" -maxdepth 1 -type d -name "openai.chatgpt-*" | sort | while read -r dir; do > ext_js="$dir/out/extension.js" > version=$(basename "$dir") > > if [[ ! -f "$ext_js" ]]; then > echo "[$version] extension.js not found, skipping" > continue > fi > > # Check if bug is present > if grep -q '"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}' "$ext_js"; then > echo "[$version] bug detected — patching..." > > # Backup (only once per version) > if [[ ! -f "$ext_js.bak" ]]; then > cp "$ext_js" "$ext_js.bak" > echo "[$version] backup created: extension.js.bak" > fi > > sed -i '' \ > 's/"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}/"open-in-targets":async()=>({targets:[]})/g' \ > "$ext_js" > > sed -i '' \ > 's/"set-preferred-app":async()=>{throw new Error("open-in-target not supported in extension")}/"set-preferred-app":async()=>({})/g' \ > "$ext_js" > > # Verify > if grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then > echo "[$version] patched successfully" > else > echo "[$version] patch verification failed — restoring backup" > cp "$ext_js.bak" "$ext_js" > fi > > elif grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then > echo "[$version] already patched, skipping" > else > echo "[$version] open-in-targets pattern not found — extension structure may have changed" > fi > done > > echo "" > echo "Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window" > `` 非常感谢,这个补丁在 M1 Max macOS 2.6 上真的有效。

Thank you for your help.

MingLi3306 · 3 months ago
> 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. run this script to fix it `` set -euo pipefail EXT_DIR="$HOME/.vscode/extensions" PATCHED=0 SKIPPED=0 ALREADY=0 find "$EXT_DIR" -maxdepth 1 -type d -name "openai.chatgpt-*" | sort | while read -r dir; do ext_js="$dir/out/extension.js" version=$(basename "$dir") if [[ ! -f "$ext_js" ]]; then echo "[$version] extension.js not found, skipping" continue fi # Check if bug is present if grep -q '"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}' "$ext_js"; then echo "[$version] bug detected — patching..." # Backup (only once per version) if [[ ! -f "$ext_js.bak" ]]; then cp "$ext_js" "$ext_js.bak" echo "[$version] backup created: extension.js.bak" fi sed -i '' \ 's/"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}/"open-in-targets":async()=>({targets:[]})/g' \ "$ext_js" sed -i '' \ 's/"set-preferred-app":async()=>{throw new Error("open-in-target not supported in extension")}/"set-preferred-app":async()=>({})/g' \ "$ext_js" # Verify if grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then echo "[$version] patched successfully" else echo "[$version] patch verification failed — restoring backup" cp "$ext_js.bak" "$ext_js" fi elif grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then echo "[$version] already patched, skipping" else echo "[$version] open-in-targets pattern not found — extension structure may have changed" fi done echo "" echo "Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window" ``

Thank you for your help.

KeriaGuma · 3 months ago

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 · 3 months ago

Great find, I had to kill VSCode after every prompt in the Codex plugin because of the 100% CPU

Smexey · 3 months ago

Little script i made that fixes it since any manual fixes break on update:

#!/usr/bin/env bash
#
# Source-aware local workaround for Codex VS Code CPU hotspots.
# This patches the installed extension bundle in-place and keeps a .bak copy.

set -euo pipefail

APP="auto"
CHECK_ONLY=0

usage() {
    cat <<'EOF'
Usage: fix_codex.sh [--app vscode|windsurf|auto] [--check]

Options:
  --app    Choose which editor extension to inspect. Default: auto.
  --check  Report which patches would apply without modifying files.
EOF
}

while [[ $# -gt 0 ]]; do
    case "$1" in
        --app)
            if [[ $# -lt 2 ]]; then
                echo "ERROR: --app requires a value." >&2
                exit 1
            fi

            APP="$2"
            shift 2
            ;;
        --check)
            CHECK_ONLY=1
            shift
            ;;
        -h|--help)
            usage
            exit 0
            ;;
        *)
            echo "ERROR: Unknown argument: $1" >&2
            usage >&2
            exit 1
            ;;
    esac
done

case "$APP" in
    auto|vscode|windsurf)
        ;;
    *)
        echo "ERROR: --app must be one of: auto, vscode, windsurf." >&2
        exit 1
        ;;
esac

find_extension_dir() {
    local -a base_dirs=()
    local -a candidates=()
    local base_dir

    case "$APP" in
        vscode)
            base_dirs=("$HOME/.vscode/extensions")
            ;;
        windsurf)
            base_dirs=("$HOME/.windsurf/extensions")
            ;;
        auto)
            base_dirs=("$HOME/.vscode/extensions" "$HOME/.windsurf/extensions")
            ;;
    esac

    for base_dir in "${base_dirs[@]}"; do
        if [[ -d "$base_dir" ]]; then
            while IFS= read -r candidate; do
                [[ -n "$candidate" ]] && candidates+=("$candidate")
            done < <(ls -d "$base_dir"/openai.chatgpt-*-darwin-arm64 2>/dev/null || true)
        fi
    done

    if [[ ${#candidates[@]} -eq 0 ]]; then
        return 1
    fi

    printf '%s\n' "${candidates[@]}" | while IFS= read -r candidate; do
        printf '%s\t%s\n' \
            "$(basename "$candidate" | sed -E 's/^openai\.chatgpt-//; s/-darwin-arm64$//')" \
            "$candidate"
    done | sort -V | tail -1 | cut -f2-
}

EXT_DIR=$(find_extension_dir || true)

if [[ -z "${EXT_DIR:-}" ]]; then
    echo "ERROR: Could not find Codex extension directory in ~/.windsurf/extensions or ~/.vscode/extensions."
    exit 1
fi

BUNDLE=$(ls "$EXT_DIR"/webview/assets/index-*.js 2>/dev/null | head -1)
EXT_HOST="$EXT_DIR/out/extension.js"

if [[ -z "${BUNDLE:-}" ]]; then
    echo "ERROR: Could not find Codex webview bundle."
    exit 1
fi

if [[ ! -f "$EXT_HOST" ]]; then
    echo "ERROR: Could not find Codex extension host bundle."
    exit 1
fi

echo "Found extension: $EXT_DIR"
echo "Found bundle:    $BUNDLE"
echo "Found host JS:   $EXT_HOST"
echo "App mode:        $APP"
echo "Check only:      $CHECK_ONLY"
echo "Size:            $(du -h "$BUNDLE" | cut -f1)"

if [[ "$CHECK_ONLY" -eq 0 ]]; then
    if [[ ! -f "$BUNDLE.bak" ]]; then
        cp "$BUNDLE" "$BUNDLE.bak"
        echo "Backup created:  $BUNDLE.bak"
    else
        echo "Backup exists:   $BUNDLE.bak"
    fi

    if [[ ! -f "$EXT_HOST.bak" ]]; then
        cp "$EXT_HOST" "$EXT_HOST.bak"
        echo "Backup created:  $EXT_HOST.bak"
    else
        echo "Backup exists:   $EXT_HOST.bak"
    fi
fi

PATCHED=0

replace_all() {
    local old="$1"
    local new="$2"
    local label="$3"

    python3 - "$BUNDLE" "$old" "$new" "$label" "$CHECK_ONLY" <<'PY'
from pathlib import Path
import sys

bundle_path = Path(sys.argv[1])
old = sys.argv[2]
new = sys.argv[3]
label = sys.argv[4]
check_only = sys.argv[5] == "1"

text = bundle_path.read_text()
count = text.count(old)
if count == 0:
    print(f"{label}: skipped")
    raise SystemExit(1)

if check_only:
    print(f"{label}: would apply ({count} replacements)")
else:
    bundle_path.write_text(text.replace(old, new))
    print(f"{label}: applied ({count} replacements)")
PY
}

replace_all_in_file() {
    local file_path="$1"
    local old="$2"
    local new="$3"
    local label="$4"

    python3 - "$file_path" "$old" "$new" "$label" "$CHECK_ONLY" <<'PY'
from pathlib import Path
import sys

bundle_path = Path(sys.argv[1])
old = sys.argv[2]
new = sys.argv[3]
label = sys.argv[4]
check_only = sys.argv[5] == "1"

text = bundle_path.read_text()
count = text.count(old)
if count == 0:
    print(f"{label}: skipped")
    raise SystemExit(1)

if check_only:
    print(f"{label}: would apply ({count} replacements)")
else:
    bundle_path.write_text(text.replace(old, new))
    print(f"{label}: applied ({count} replacements)")
PY
}

echo ""
echo "Checking for known Codex CPU hotspots"
echo "============================================"

if replace_all \
    'pp={numStars:1900,minStars:700,starsPerMegaPixel:900,baseTrailLength:2,maxTrailLength:22,speedBase:1,speedWarpMultiplier:38,clearAlphaWarpMultiplier:.8,warpEasing:.06,warpAlphaDamp:.35,idleMaxFps:20,activeMaxFps:60,unfocusedFpsMultiplier:.6' \
    'pp={numStars:200,minStars:100,starsPerMegaPixel:100,baseTrailLength:2,maxTrailLength:22,speedBase:1,speedWarpMultiplier:38,clearAlphaWarpMultiplier:.8,warpEasing:.06,warpAlphaDamp:.35,idleMaxFps:5,activeMaxFps:15,unfocusedFpsMultiplier:.1' \
    'PATCH 1 legacy starfield'; then
    PATCHED=$((PATCHED + 1))
fi

if replace_all \
    'oe?le=0:i&&!a&&(le=1e3)' \
    'oe?le=1e3:i&&!a&&(le=1e3)' \
    'PATCH 2 legacy interval'; then
    PATCHED=$((PATCHED + 1))
fi

if replace_all \
    'm.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`style`,`class`,`hidden`,`aria-hidden`]})' \
    'm.observe(document.body,{childList:!0,subtree:!1,attributes:!0,attributeFilter:[`style`,`class`,`hidden`,`aria-hidden`]})' \
    'PATCH 3 hotkey observer'; then
    PATCHED=$((PATCHED + 1))
fi

if replace_all \
    'se?ue=0:i&&!a&&(ue=1e3)' \
    'se?ue=1e3:i&&!a&&(ue=1e3)' \
    'PATCH 4 prerelease exec interval'; then
    PATCHED=$((PATCHED + 1))
fi

if replace_all \
    'if(document.hidden)return;if(n-T.current>=e-1){' \
    'if(document.hidden){w.current=null;return}if(n-T.current>=e-1){' \
    'PATCH 5 sign-in hidden loop'; then
    PATCHED=$((PATCHED + 1))
fi

if replace_all \
    'let n=()=>{document.hidden||(T.current=0)};' \
    'let n=()=>{document.hidden||(T.current=0,w.current==null&&(w.current=window.requestAnimationFrame(t)))};' \
    'PATCH 6 sign-in resume'; then
    PATCHED=$((PATCHED + 1))
fi

if replace_all \
    'loop:h,renderConfig:te,autoplay:ne,className:`pointer-events-none h-full w-full contain-[paint_style_layout_inline-size]`' \
    'loop:h,renderConfig:te,autoplay:!1,className:`pointer-events-none h-full w-full contain-[paint_style_layout_inline-size]`' \
    'PATCH 9 animated icon autoplay disable'; then
    PATCHED=$((PATCHED + 1))
fi

if replace_all_in_file \
    "$EXT_HOST" \
    '"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")}' \
    '"open-in-targets":async()=>({preferredTarget:null,availableTargets:[],targets:[]}),"set-preferred-app":async()=>({success:!1})' \
    'PATCH 7 open target handler'; then
    PATCHED=$((PATCHED + 1))
fi

if replace_all_in_file \
    "$EXT_HOST" \
    'this.anyBroadcastHandlers.size===0&&this.logger.warning("Received broadcast but no handler is configured",{safe:{method:e.method},sensitive:{}})' \
    'this.anyBroadcastHandlers.size===0&&e.method!=="thread-stream-state-changed"&&e.method!=="client-status-changed"&&this.logger.warning("Received broadcast but no handler is configured",{safe:{method:e.method},sensitive:{}})' \
    'PATCH 8 thread stream warning suppression'; then
    PATCHED=$((PATCHED + 1))
fi

if replace_all_in_file \
    "$EXT_HOST" \
    '"local-environments":async()=>{throw new Error("local-environments is not supported in the extension")}' \
    '"local-environments":async()=>[]' \
    'PATCH 10 local environments fallback'; then
    PATCHED=$((PATCHED + 1))
fi

echo ""
echo "============================================"
if [[ "$CHECK_ONLY" -eq 1 ]]; then
    echo "  $PATCHED patches would apply"
else
    echo "  $PATCHED patches applied"
fi
echo "============================================"
echo ""

if [[ "$CHECK_ONLY" -eq 0 ]]; then
    echo "Next: Reload Windsurf or VS Code"
    echo "  Cmd+Shift+P -> 'Developer: Reload Window'"
    echo ""
    echo "To restore original:"
    echo "  cp \"$BUNDLE.bak\" \"$BUNDLE\""
    echo "  cp \"$EXT_HOST.bak\" \"$EXT_HOST\""
fi
sammydigits · 3 months ago

Can we get an official fix please Codex team?

ofrnsb · 3 months ago
Can we get an official fix please Codex team?

lets hope so lol

ohcedar · 3 months ago

I dug into this on macOS and can confirm the same failure mode with process samples and extension logs.

Environment:

  • VS Code 1.114.0
  • macOS 26.4 (25E246)
  • extension logs point to openai.chatgpt-26.325.31654-darwin-arm64

What I observed:

  • the high-CPU processes were VS Code helper processes, specifically the extension host plus one or more renderer/webview processes
  • the extension host had Codex.log and codex-ipc open under the openai.chatgpt VS Code log directory
  • a sample of the extension-host process showed heavy time in spdlog.node flushing / rotating log files, consistent with a log storm
  • sample output for the renderer processes showed hot Electron/V8 main-thread work rather than idle waiting, which lines up with a busy webview/render loop on top of the extension-host logging

Log-storm evidence:

  • the Codex log directory had Codex.1.log through Codex.6.log, each around 5.24 MB
  • the current Codex.log was still being appended while I checked it
  • in the active Codex.log, I counted 583 occurrences of open-in-target not supported in extension in a 0.777s window
  • example line:
2026-04-09 09:35:07.854 [error] Error fetching errorMessage="open-in-target not supported in extension" ... url=vscode://codex/open-in-targets

So from this machine at least, the pattern is:

  1. the Codex UI is loaded in a VS Code window
  2. open-in-targets requests start failing in a tight loop
  3. the extension host burns CPU on logging / flush / rotation
  4. one or more webview renderers also peg CPU

This lines up with the root-cause analysis in the issue body: the unsupported handler is throwing instead of returning a graceful no-op, and the repeated failures drive both log churn and renderer churn.

piotrkacala · 3 months ago

Additional confirmation: VSCodium on Linux, with timing analysis

Environment:

  • VSCodium (Linux x64)
  • Extension version: 26.406.31014

---

Key observation

This is not a slow polling issue. The errors fire in a tight burst loop — 11 errors within ~209ms, with no backoff whatsoever.

Timing breakdown from log:

| Gap | Interval |
|-----|----------|
| 17:54:23.714 → .742 | +28ms |
| 17:54:23.742 → .765 | +23ms |
| 17:54:23.765 → .772 | +7ms ← tight pair |
| 17:54:23.772 → .799 | +27ms |
| 17:54:23.799 → .822 | +23ms |
| 17:54:23.822 → .829 | +7ms ← tight pair |
| 17:54:23.829 → .854 | +25ms |
| 17:54:23.854 → .886 | +32ms |
| 17:54:23.886 → .917 | +31ms |
| 17:54:23.917 → .923 | +6ms ← tight pair |

Errors appear in pairs separated by ~6–7ms, with ~23–30ms between groups. This suggests multiple parallel call sites firing simultaneously (e.g. a render cycle or event fan-out), not a simple retry timer.

---

Observed behavior

  • Extension enabled → high CPU (single core 50–100%) + heavy disk I/O from log spam
  • Extension disabled → problem disappears immediately

Failing endpoint

vscode://codex/open-in-targets

The handler throws instead of returning gracefully, and the caller retries with no backoff — confirmed by the tight burst pattern above.

---

Confirmed fix works: manually patching open-in-targets to return { targets: [] } instead of throwing eliminates the CPU spike and log spam entirely. Tested on VSCodium Linux x64, extension 26.406.31014.
Patch confirmed working — no more open-in-targets errors or CPU spike after reload.

---

Separately, while testing I noticed a different warning flooding the log during
normal text rendering (no tools/diffs involved):
[IpcClient] Received broadcast but no handler is configured method=thread-stream-state-changed

This appears to be an independent bug — it reproduces without the open-in-targets
issue and vice versa. Causes ~5 MiB/s of disk writes during streaming responses.
Not filing here — just flagging in case it's already tracked.

younjungpark · 3 months ago

I could reproduce this on Windows as well, and the same workaround fixes it there.

For anyone who needs a temporary Windows-side patch before an official fix lands, this PowerShell script backs up extension.js, replaces the two throwing handlers with no-op return values, and verifies the result.

For Antigravity, use:
$env:USERPROFILE\.antigravity\extensions\openai.chatgpt-*\out\extension.js

For VS Code, change that path to:
$env:USERPROFILE\.vscode\extensions\openai.chatgpt-*\out\extension.js

$sExtensionDir = Get-ChildItem `
    "$env:USERPROFILE\.antigravity\extensions" `
    -Directory `
| Where-Object { $_.Name -like "openai.chatgpt-*" } `
| Sort-Object Name -Descending `
| Select-Object -First 1

if ($null -eq $sExtensionDir) {
    throw "Could not find an openai.chatgpt-* extension directory."
}

$sExtensionFile = Join-Path $sExtensionDir.FullName "out\extension.js"

if (-not (Test-Path -LiteralPath $sExtensionFile)) {
    throw "Could not find extension.js: $sExtensionFile"
}

$sBackupFile = "$sExtensionFile.bak"

$sOpenTargetsPattern = '"open-in-targets"\s*:\s*async\(\)\s*=>\s*\{throw new Error\("open-in-target not supported in extension"\)\}'
$sSetPreferredAppPattern = '"set-preferred-app"\s*:\s*async\(\)\s*=>\s*\{throw new Error\("open-in-target not supported in extension"\)\}'
$sAfterOpenTargets = '"open-in-targets":async()=>({targets:[]})'
$sAfterSetPreferredApp = '"set-preferred-app":async()=>({})'

Copy-Item -LiteralPath $sExtensionFile -Destination $sBackupFile -Force

$sContent = [System.IO.File]::ReadAllText($sExtensionFile)

if (-not ([regex]::IsMatch($sContent, $sOpenTargetsPattern))) {
    throw "Could not find the original open-in-targets handler."
}

if (-not ([regex]::IsMatch($sContent, $sSetPreferredAppPattern))) {
    throw "Could not find the original set-preferred-app handler."
}

$sOpenTargetsRegex = [regex]::new($sOpenTargetsPattern)
$sSetPreferredAppRegex = [regex]::new($sSetPreferredAppPattern)

$sContent = $sOpenTargetsRegex.Replace($sContent, $sAfterOpenTargets, 1)
$sContent = $sSetPreferredAppRegex.Replace($sContent, $sAfterSetPreferredApp, 1)

[System.IO.File]::WriteAllText(
    $sExtensionFile,
    $sContent,
    (New-Object System.Text.UTF8Encoding($false))
)

$sPatchedContent = [System.IO.File]::ReadAllText($sExtensionFile)

if (-not $sPatchedContent.Contains($sAfterOpenTargets)) {
    throw "Verification failed for open-in-targets replacement."
}

if (-not $sPatchedContent.Contains($sAfterSetPreferredApp)) {
    throw "Verification failed for set-preferred-app replacement."
}

if ($sPatchedContent.Contains('open-in-target not supported in extension')) {
    throw "The throw string is still present after patching."
}

Write-Host "Backup file:" $sBackupFile
Write-Host "Patched file:" $sExtensionFile
Write-Host "String verification completed"
bwesen · 3 months ago

Bug still in the new 26.409.20454 release that overwrote my previous fixed extension.js

shijie-oai contributor · 3 months ago

Hi all! We have merged a fix and this should be addressed by the next release. Sorry about the close notification - linear was too eager at closing the ticket when we mark the task done internally.

ofrnsb · 3 months ago

thanks @shijie-oai!
you might want to see another cases as well, will describe it here later.

Dagsi · 3 months ago
Hi all! We have merged a fix and this should be addressed by the next release. Sorry about the close notification - linear was too eager at closing the ticket when we mark the task done internally.

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 · 3 months ago

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 contributor · 3 months ago

Hi all! We should be releasing a VSCE version soon - I will post back when the version is updated.

tinkeridze · 3 months ago

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

<img width="941" height="373" alt="Image" src="https://github.com/user-attachments/assets/c201b2ab-73b0-4f72-bbad-c324101b0941" />

<img width="517" height="237" alt="Image" src="https://github.com/user-attachments/assets/33b5dc09-27d9-465a-8abb-9eb61075320c" />

ofrnsb · 3 months ago
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.

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 · 3 months ago
> 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. run this script to fix it `` set -euo pipefail EXT_DIR="$HOME/.vscode/extensions" PATCHED=0 SKIPPED=0 ALREADY=0 find "$EXT_DIR" -maxdepth 1 -type d -name "openai.chatgpt-*" | sort | while read -r dir; do ext_js="$dir/out/extension.js" version=$(basename "$dir") if [[ ! -f "$ext_js" ]]; then echo "[$version] extension.js not found, skipping" continue fi # Check if bug is present if grep -q '"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}' "$ext_js"; then echo "[$version] bug detected — patching..." # Backup (only once per version) if [[ ! -f "$ext_js.bak" ]]; then cp "$ext_js" "$ext_js.bak" echo "[$version] backup created: extension.js.bak" fi sed -i '' \ 's/"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}/"open-in-targets":async()=>({targets:[]})/g' \ "$ext_js" sed -i '' \ 's/"set-preferred-app":async()=>{throw new Error("open-in-target not supported in extension")}/"set-preferred-app":async()=>({})/g' \ "$ext_js" # Verify if grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then echo "[$version] patched successfully" else echo "[$version] patch verification failed — restoring backup" cp "$ext_js.bak" "$ext_js" fi elif grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then echo "[$version] already patched, skipping" else echo "[$version] open-in-targets pattern not found — extension structure may have changed" fi done echo "" echo "Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window" ``

this script still works.

Ga1axy0 · 3 months ago
> > 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. > > > run this script to fix it > `` > set -euo pipefail > > EXT_DIR="$HOME/.vscode/extensions" > PATCHED=0 > SKIPPED=0 > ALREADY=0 > > find "$EXT_DIR" -maxdepth 1 -type d -name "openai.chatgpt-*" | sort | while read -r dir; do > ext_js="$dir/out/extension.js" > version=$(basename "$dir") > > if [[ ! -f "$ext_js" ]]; then > echo "[$version] extension.js not found, skipping" > continue > fi > > # Check if bug is present > if grep -q '"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}' "$ext_js"; then > echo "[$version] bug detected — patching..." > > # Backup (only once per version) > if [[ ! -f "$ext_js.bak" ]]; then > cp "$ext_js" "$ext_js.bak" > echo "[$version] backup created: extension.js.bak" > fi > > sed -i '' \ > 's/"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}/"open-in-targets":async()=>({targets:[]})/g' \ > "$ext_js" > > sed -i '' \ > 's/"set-preferred-app":async()=>{throw new Error("open-in-target not supported in extension")}/"set-preferred-app":async()=>({})/g' \ > "$ext_js" > > # Verify > if grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then > echo "[$version] patched successfully" > else > echo "[$version] patch verification failed — restoring backup" > cp "$ext_js.bak" "$ext_js" > fi > > elif grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then > echo "[$version] already patched, skipping" > else > echo "[$version] open-in-targets pattern not found — extension structure may have changed" > fi > done > > echo "" > echo "Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window" > `` this script still works.

Does it work or not?

[openai.chatgpt-26.415.20818-darwin-arm64] open-in-targets pattern not found — extension structure may have changed

Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window
Ga1axy0 · 3 months ago
Hi all! We should be releasing a VSCE version soon - I will post back when the version is updated.

Does the newest version 26.415.20818 solved this issue? Same problem happened when I using the codex extention.

ofrnsb · 3 months ago
> > > 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. > > > > > > run this script to fix it > > `` > > set -euo pipefail > > > > EXT_DIR="$HOME/.vscode/extensions" > > PATCHED=0 > > SKIPPED=0 > > ALREADY=0 > > > > find "$EXT_DIR" -maxdepth 1 -type d -name "openai.chatgpt-*" | sort | while read -r dir; do > > ext_js="$dir/out/extension.js" > > version=$(basename "$dir") > > > > if [[ ! -f "$ext_js" ]]; then > > echo "[$version] extension.js not found, skipping" > > continue > > fi > > > > # Check if bug is present > > if grep -q '"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}' "$ext_js"; then > > echo "[$version] bug detected — patching..." > > > > # Backup (only once per version) > > if [[ ! -f "$ext_js.bak" ]]; then > > cp "$ext_js" "$ext_js.bak" > > echo "[$version] backup created: extension.js.bak" > > fi > > > > sed -i '' \ > > 's/"open-in-targets":async()=>{throw new Error("open-in-target not supported in extension")}/"open-in-targets":async()=>({targets:[]})/g' \ > > "$ext_js" > > > > sed -i '' \ > > 's/"set-preferred-app":async()=>{throw new Error("open-in-target not supported in extension")}/"set-preferred-app":async()=>({})/g' \ > > "$ext_js" > > > > # Verify > > if grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then > > echo "[$version] patched successfully" > > else > > echo "[$version] patch verification failed — restoring backup" > > cp "$ext_js.bak" "$ext_js" > > fi > > > > elif grep -q '"open-in-targets":async()=>({targets:\[\]})' "$ext_js"; then > > echo "[$version] already patched, skipping" > > else > > echo "[$version] open-in-targets pattern not found — extension structure may have changed" > > fi > > done > > > > echo "" > > echo "Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window" > > ` > > > this script still works. Does it work or not? ` [openai.chatgpt-26.415.20818-darwin-arm64] open-in-targets pattern not found — extension structure may have changed Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window ``

hmmm, it does work on my machine

ofrnsb · 3 months ago
> Hi all! We should be releasing a VSCE version soon - I will post back when the version is updated. Does the newest version 26.415.20818 solved this issue? Same problem happened when I using the codex extention.

update to 26.5409.20454 using VSIX then run that script. works perfectly

Ga1axy0 · 3 months ago

26.5415.20818 is the newest version, and it seems like remove the parameter used in the script, which cause the failure of it.

<img width="1187" height="400" alt="Image" src="https://github.com/user-attachments/assets/0cc906e2-9a15-408c-b1f4-bdba8e2f8dd5" />

nicohouillon · 2 months ago

My cpu was about 130% with 417 (or 5417 pre release) , I tried the patch but didnt work :

[openai.chatgpt-26.5417.40842-darwin-arm64] open-in-targets pattern not found — extension structure may have changed

Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window

Then I downgraded to .409. and applied the patch, but perf got even worse (300%)

The script doesnt fix the problem unfortunately

nkawli · 2 months ago
My cpu was about 130% with 417 (or 5417 pre release) , I tried the patch but didnt work : `` [openai.chatgpt-26.5417.40842-darwin-arm64] open-in-targets pattern not found — extension structure may have changed Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window `` Then I downgraded to .409. and applied the patch, but perf got even worse (300%) The script doesnt fix the problem unfortunately

+1

ofrnsb · 2 months ago
My cpu was about 130% with 417 (or 5417 pre release) , I tried the patch but didnt work : `` [openai.chatgpt-26.5417.40842-darwin-arm64] open-in-targets pattern not found — extension structure may have changed Done. Reload VS Code windows to apply: Cmd+Shift+P → Developer: Reload Window `` Then I downgraded to .409. and applied the patch, but perf got even worse (300%) The script doesnt fix the problem unfortunately

that's the pain-point with personal patch, it only works on specific circumstance, in this case, mine.

Showing cached comments. Read the full discussion on GitHub ↗