vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Agent Host: `create_session` chats show the wrong model in the picker; next send switches to it

Open wcushing-st opened this issue 2 weeks ago • 0 comments

When an agent creates a chat with create_session, the new chat's model picker can show a model other than the one the chat is using. If I send the next prompt without touching the picker, that model becomes the real selection. An Auto chat gets pinned to whichever model Auto routed its first reply to (isAuto goes from true to false). If the new chat loads before its first reply finishes, an explicit model can instead be replaced by whatever the picker already showed (here Fusion (Max), recorded as auto).

Environment: VS Code 1.146.0 (Universal), commit 69047191fc427f2f92828279aae1d90d8eeda7ab, macOS (Darwin arm64 27.0.0). Agents window connected over SSH to a Linux agent host (Copilot provider). The creating chat's picker was Copilot Fusion (Max).

Steps

  1. From an agent chat, have the agent call create_session with the prompt Reply with exactly OK. Do not call tools., the default relationship, an existing folder workspace and worktree: false. Omit model, or pass auto or claude-haiku-4.5.
  2. Open the new chat and note its picker without changing it. With claude-haiku-4.5, the bug reproduced only when the chat first loaded before its reply finished (E3, E4).
  3. Send the same prompt from the new chat.

Expected: the picker shows the model the chat was created with, and the next send keeps it.

Results

I didn't touch any test chat's picker before step 3. Every prompt got exactly OK, with no tool calls or errors. Picker labels are what I saw (no screenshots); model changes and isAuto come from the host's events.jsonl; first-load times come from the client's loadRemoteSession inputState source log entry.

Case model passed First reply First load vs. first reply Picker showed Next send
E1 omitted Auto → GPT-6 Luna not captured GPT-6 Luna auto -> gpt-6-luna, isAuto: false
E2 auto Auto → GPT-6 Luna not captured GPT-6 Luna auto -> gpt-6-luna, isAuto: false
E3 claude-haiku-4.5 Haiku 4.5 1.9s before the reply finished Fusion (Max) claude-haiku-4.5 -> auto; Fusion replied
E4 claude-haiku-4.5 Haiku 4.5 27 min after Haiku 4.5 no change (control)
E5 omitted Auto → GPT-6 Luna 13.9s after GPT-6 Luna not sent (repeats E1 to capture first load)

Haiku 4.5 was available in E3's model menu. E4 and E5 opened in the background on their own, so I didn't control when they first loaded; I don't know whether E3 loaded early because I opened it or because the client did.

Likely cause

At commit 69047191:

  • _startSessionPrompt builds the agent-authored initial message without its model selection, and _dispatchTurnStarted dispatches it unchanged, so lastTurnModelSelection has nothing to restore.
  • Once the reply has usage, turnsToHistory falls back to the usage model (the concrete model Auto routed to), and createRemoteSessionModel seeds the picker from that history. E5's first load had historySelectedModel: gpt-6-luna although its selection was auto.
  • Before any usage exists, there is no incoming selection, and _syncFromModel keeps the picker's current value. E3's first load had every incoming model field undefined (hasInitialData: false).

Either way, the next send makes the picker's value the session's model. Recording the selection on the agent-authored message would likely fix loads after the first reply; loads before it may also need the picker seeded from the session's own selection.

Timestamps and first-load log fields

Host times (UTC):

Case First reply usage Model change on next send (source: sdk) Next reply usage
E1 2026-11-13 23:10:55.749 23:22:05.012 23:22:07.347
E2 2026-11-13 23:26:16.113 23:29:06.602 23:29:09.014
E3 2026-11-13 23:31:40.177 23:33:20.230 23:33:23.627
E4 2026-11-16 23:10:26.250 2026-11-17 00:57:10.707 (no-op) 00:57:12.366
E5 2026-11-17 00:58:19.971 — —

Each new chat's first loadRemoteSession inputState source entry (client log level Debug). The client clock is UTC-8 relative to the host; model IDs omit the remote-authority prefix.

Case Client time historySelectedModel transferredSelectedModel storedSelectedModel finalSelectedModel hasInitialData
E3 15:31:38.284 undefined undefined undefined undefined false
E4 15:37:30.085 claude-haiku-4.5 undefined undefined claude-haiku-4.5 true
E5 16:58:33.835 gpt-6-luna undefined undefined gpt-6-luna true

Related: #345430 reports a similar symptom (the picker switches models on its own); I haven't established that it has the same cause. #342483 covers create_session being unable to set reasoning effort or context tier.

Investigated with GitHub Copilot, which analyzed the host logs and VS Code source.

wcushing-st avatar Nov 17 '26 21:11 wcushing-st