Vscode extension steals focus when vscode starts and extension gets loaded
Open 💬 4 comments Opened Nov 30, 2025 by JohnnyBill
💡 Likely answer: A maintainer (github-actions[bot], contributor)
responded on this thread — see the highlighted reply below.
What version of the VS Code extension are you using?
0.5.46
What subscription do you have?
ChatGPT Pro
Which IDE are you using?
VS Code
What platform is your computer?
Ubuntu 24.04
What issue are you seeing?
When i start vscode, i often open an integrated terminal and start typing in it immediately, before the codex extension on the right sidebar has finished loading. When the extension finished loading, it steals the focus from the terminal. That's quite annoying. "chatgpt.openOnStartup": false, Doesn't help either, because the secondary sidebar state get's stored by VSCode. The extension just shouldn't steal focus on the initial load.
What steps can reproduce the bug?
Put codex in the secondary sidebar, close vscode, open it again, start typing in an editor or terminal window and see what happens with the focus when the extension finishes loading
What is the expected behavior?
_No response_
Additional information
_No response_
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
Still reproducible with current versions:
openai.chatgpt26.820.60940 (linux-x64)"chatgpt.openOnStartup": falseReproduction:
This is more than an annoyance: text intended for a masked terminal prompt can instead be entered into the visible Codex composer, and pressing Enter can submit that credential.
chatgpt.openOnStartup: falsedoes not prevent this because VS Code restores the secondary-sidebar state and the composer takes focus when its webview mounts.Expected behavior: restoring or mounting the Codex webview during IDE startup must not move keyboard focus. The composer should only receive focus after an explicit user action targeting Codex.
Confirmed workaround: the startup focus grab stopped after changing the primary composer's bundled prop from:
After making that single replacement in the installed extension's webview bundle, I validated the JavaScript syntax and ran Developer: Reload Window. The Codex composer then stopped stealing keyboard focus when the extension finished loading during VS Code startup.
This indicates that the primary composer is mounted with autofocus enabled in its
defaultmode, independently ofchatgpt.openOnStartup. These settings had not prevented the behavior:This is only an unofficial workaround. Editing a bundled extension file is version-specific, and an extension update or reinstall will overwrite it. The proper fix should prevent composer autofocus during extension startup unless the user explicitly focuses Codex.
Hi all, thanks for reporting this, and thanks @magist3r for the detailed reproduction and analysis.
We've reproduced the issue and merged a fix. When VS Code restores the Codex sidebar at startup, the composer should no longer take focus away from the editor or terminal. Explicit actions such as opening Codex or starting a new chat will still focus the composer.
I'll update this issue with the extension version once the fix is released.