VS Code IDE context auto-disables and selected text is not attached in WSL2
What version of the IDE extension are you using?
26.721.41059
What subscription do you have?
Plus
Which IDE are you using?
VS Code
What platform is your computer?
6.18.33.2-microsoft-standard-WSL2 x86_64 x86_64 GNU/Linux
What issue are you seeing?
Automatic IDE context initially appears enabled in the VS Code Codex
composer, but the IDE context indicator disappears after a short time.
Messages sent afterward do not include the active file or selected text.
Running /ide-context or reloading VS Code does not permanently fix it.
The extension log reports:
[Composer] failed to fetch ide-context error={}
The persisted composer-auto-context-enabled state is then changed to
false.
This reproduced after:
- restarting WSL
- restarting Windows
- uninstalling and reinstalling the Codex extension in WSL
Steps to reproduce
- Open a repository using VS Code Remote - WSL.
- Open a normal file-backed editor.
- Select several lines.
- Open the Codex sidebar.
- Enable
/ide-context. - Wait briefly or send a message.
- Observe that the IDE context indicator disappears.
- Ask Codex to identify the selected lines.
- Observe that no active-file or selection context is attached.
Expected behavior
The IDE context setting should remain enabled, and each message should
include the active file, selected text, and open tabs.
Actual behavior
IDE context discovery fails, the setting is automatically disabled, and
selected text is omitted.
Additional diagnosis
The VS Code editor-side provider itself is working:
- A standalone Codex CLI running in the same WSL workspace with
/ide on
successfully receives the active file and exact selected text.
- Therefore VS Code selection tracking and the IDE IPC socket are healthy.
Inspection of the clean-installed extension bundle showed that:
- the non-Electron/VS Code path can request IDE context with an empty
workspaceRoot;
- a discovery error automatically persists the IDE-context preference as
disabled;
- the Webview
clientCoordinationpath fails even though the editor-side
provider can return the selection.
A local workaround that preserves the enabled preference and retrieves the
selection directly through the VS Code host bridge restores IDE context
without changing VS Code, WSL, authentication, or network configuration.
This appears related to, but distinct from:
What steps can reproduce the bug?
Feedback ID: 019f9bde-3cda-77f2-8730-84e17b1237a0
What is the expected behavior?
When IDE context is enabled, it should remain enabled and visible in the Codex composer. Each message should automatically include the current active file, selected text, and open tabs. Reloading VS Code should preserve this setting, and transient IDE discovery failures should not disable it.
Additional information
I reproduced the issue on a clean installation before applying any local
changes.
As a diagnostic workaround, I modified the installed extension locally to:
- Always pass the actual workspace root when requesting IDE context,
instead of passing an empty string on the VS Code/non-Electron path.
- Prevent a transient IDE discovery failure from automatically persisting
composer-auto-context-enabled as disabled.
- Bypass the failing
clientCoordination.getIdeContext()Webview RPC and
retrieve the current IDE context directly through a VS Code host bridge
backed by the extension's existing editor-selection provider.
After reloading VS Code, the Codex message correctly contained:
- the active file path;
- the exact selected lines;
- the list of open tabs.
This confirms that VS Code selection tracking and the editor-side provider
were working, while the failure was in the extension's Webview/context
transport path.
This is only a local diagnostic workaround, not a proposed production patch.
It modifies generated extension bundle files and will be overwritten by an
extension update or reinstall.
6 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I reviewed #34696, #34920, and #35333.
This report overlaps with those issues, but adds a current
26.721.41059reproduction specifically under VS Code Remote - WSL2.In this reproduction:
workspaceRootfixes IDE discovery, but theclientCoordinationIDE-context path still fails, which appears relatedto #34920;
changed to
false;selection, confirming that the editor provider and IPC socket are healthy;
the active file, selected text, and open tabs.
I am leaving this open for maintainer triage because it documents the
current WSL2 behavior and the combined two-stage failure. I am happy for it
to be closed if maintainers confirm that it has the same root cause.
It happens not only on WSL2, but also on Ubuntu.
This is also happening on my MacBook M5 Pro with every version after 26.707.91948.
This appears to be fixed in 26.5803.41515 for me.
Hi folks, thanks for the reports. This issue should be resolved in the Codex IDE extension as of:
Please update the Codex IDE extension to one of these versions or a newer version; if the issue persists after updating, please comment with your extension version, editor, and operating system and we can investigate further.