mirror of
https://github.com/microsoft/vscode.git
synced 2026-06-19 21:15:09 -05:00
The local agent host runs a single sessions provider whose session cache holds every agent-host session type (codex, claude, copilot). When a new session is sent, the provider identifies the freshly-committed backend session in `_waitForNewSession` purely by novelty — the first cached session whose raw id was not present before the send. The session's type/scheme was never checked. That is wrong when a session of a *different* type appears in the cache during the send. A slow Codex session (which cold-starts a native app-server before its first /responses turn) sent while a Claude session from an earlier run is present would latch onto the Claude session and return it as the Codex commit. `sendRequest` then reports an "active session replaced: codex -> claude", the workbench swaps the active slot to the wrong session, removes the Codex one, and the Codex reply renders nowhere. A claude harness that is suppressed in the current window (preferAgentHost=false) additionally throws "Agent host targets must have an item provider" when activated. This is exactly why the Codex smoke test timed out on the Windows CI runner (where the cold-start race is widest), failing build 449022. Filter `_waitForNewSession` by the `chatResource` scheme so a send only ever commits a session of its own type, in both the immediate cache scan and the onDidChangeSessions wait. Re-enable the Codex smoke test that was disabled in #321983 to keep the build green. Verified: a new unit test reproduces the cross-type latch (fails before, passes after); live launch with stale claude sessions present shows the Codex session stays active with no wrong swap; and the (re-enabled) Codex smoke test passes locally end-to-end. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
VS Code Tests
Contents
This folder contains the various test runners for VS Code. Please refer to the documentation within for how to run them: