vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Copilot Harness: BYOK custom-endpoint model not selectable for Remote Scenarios (WSL, Dev Containers, SSH etc)

Open tyrsson opened this issue 3 months ago • 39 comments

Issue Type: Bug Report

VS Code version: 1.134.0 (user setup) Copilot: 1.0.81-0 OS: Windows 11, WSL2 (Remote-WSL, Ubuntu)


Summary

A Bring-Your-Own-Key (BYOK) model configured via the Custom Endpoint provider appears in the Agents window model picker for local Windows workspaces, but is missing for WSL workspaces, even with the required experimental flag enabled.

Settings (User scope, global settings.json)

"chat.agentHost.enabled": true,
"chat.agentHost.byokModels.enabled": true

Model config (chatLanguageModels.json, Custom Endpoint, Chat Completions)

[
  {
    "name": "DeepSeek",
    "vendor": "customendpoint",
    "apiKey": "<redacted>",
    "apiType": "chat-completions",
    "models": [
      {
        "id": "deepseek-v4-pro",
        "name": "DeepSeek V4 Pro",
        "url": "https://api.deepseek.com/chat/completions",
        "toolCalling": true,
        "vision": false,
        "thinking": true,
        "contextWindow": 1000000,
        "maxOutputTokens": 384000
      }
    ]
  }
]

Steps to reproduce

  1. Add the BYOK Custom Endpoint model above via Chat: Manage Language Models.
  2. Enable chat.agentHost.enabled and chat.agentHost.byokModels.enabled in User settings.
  3. Fully restart VS Code (all windows closed).
  4. Open a WSL folder, open the Agents window, start a session with the Copilot harness.
  5. Open the model picker.

Expected

The DeepSeek V4 Pro model is listed and selectable.

Actual

The model is absent from the picker. It does appear in the Language Models editor (Manage Language Models), and it does appear in the Agents window picker when the session workspace is a local Windows folder instead of WSL.

Additional context

  • The same model works fine in the regular Chat view in WSL (selectable and functional, including agent/tool use).
  • The gap is specific to the Agents window + WSL workspace combination for BYOK custom-endpoint models.
  • The model has toolCalling: true, so it isn't being filtered out for lack of tool support.

tyrsson avatar Aug 22 '26 04:08 tyrsson

@vritant24 This looks closely related to #329815.

I originally reported a related BYOK + Windows/WSL2 case there. #329815 was closed after it “seemed to be solved for most”, but after comparing the exact 1.132 commit from that issue (df53daabb18cd157bdb08c7f01c34df936cf12f4) with current main, I don't think the underlying WSL / Agent Host gap was actually resolved.

A few relevant findings:

  • In 1.132, chat.agentHost.byokModels.enabled was a startup-time gate, defaulting to false.

  • The value was forwarded into the Agent Host process through VSCODE_AGENT_HOST_BYOK_MODELS_ENABLED.

  • When disabled, the renderer BYOK connection was not wired, leaving ByokLmBridgeRegistry empty. That directly explains logs such as:

    modelTarget="agent-host-copilotcli"
    availableModels="agent-host-copilotcli:auto"
    

    In that state, the failure occurs before any request reaches the custom endpoint — the Agent Host catalog simply never receives the BYOK model.

Current main has improved this substantially:

  • the BYOK setting is synchronized into the running Agent Host and no longer requires restart;
  • CopilotAgent reacts to config changes and republishes BYOK models;
  • the renderer bridge now also reacts to model visibility / BYOK enablement changes.

However, current source still explicitly distinguishes two Agent Host topologies:

{ kind: 'renderer'; bridgeRegistry: IByokLmBridgeRegistry }
| { kind: 'unavailable' }

The local utility-process Agent Host uses:

byok: { kind: 'renderer', bridgeRegistry: byokLmBridgeRegistry }

while the standalone Agent Host path uses:

byok: { kind: 'unavailable' }

That seems very relevant to #332085, where the behavior is:

  • Windows local workspace: BYOK model works in Agents
  • Remote-WSL workspace: same BYOK model disappears from the Agents picker
  • regular Chat inside WSL: BYOK still works

This is also consistent with your earlier comment in #329815 that BYOK models were unsupported when using a remote Agent Host inside WSL.

So the key question seems to be:

Is a Remote-WSL Agents session currently expected to use an Agent Host path where BYOK is intentionally unavailable?

If yes, then #332085 looks more like the still-unimplemented Remote Agent Host BYOK path than a custom-endpoint configuration issue.

If Remote-WSL Agents are expected to support renderer-provided BYOK now, then the renderer vs unavailable runtime split seems like a good place to investigate.

I think #329815 is useful context here because its Windows/local workaround did not cover the WSL Agent Host case, and #332085 appears to reproduce that remaining gap.

nicezic avatar Sep 06 '26 20:09 nicezic

Hello, thanks for filing the issue and providing more details around it. Looking into it, a remote path is used to communicate with the agent host in WSL scenarios, and so currently that is not supported. Since this issue is more specific to WSL, I am tracking that here. I will reference that in a comment in there. Support for WSL is added to the backlog

vritant24 avatar Sep 07 '26 00:09 vritant24

I want to add another data point for visibility: in my case this is no longer limited to the Agents window.

Over roughly the last two weeks, this appears to have regressed in the regular Chat UI as well when the workspace is opened through Remote-WSL. My BYOK custom endpoint models work as expected in normal Windows/local workspaces, but in WSL the model picker in the standard chat view/editor chat no longer behaves correctly: the BYOK models may disappear from selection, or the chat ends up routing to Copilot-hosted models instead.

So from my side, this looks broader than an Agents-window-only problem and seems to affect regular Chat sessions in WSL too.

The important variable is specifically Remote-WSL: same VS Code installation, same account, same BYOK configuration, different behavior only when the workspace is opened in WSL.

PowerfulPony avatar Sep 27 '26 16:09 PowerfulPony

I am having exact same issue also. I use the chat window from wsl and model picker is not working. Upgraded yesterday and now I have to downgrade.

hamdano2 avatar Oct 04 '26 13:10 hamdano2

Yea, they are about to lose my $100+ a month subscription. Tired of this horsesh*t. I'm actively searching for a replacement for my dev environment as I type this.

tyrsson avatar Oct 05 '26 07:10 tyrsson

Thanks for all the feedback. We are still looking into supporting WSL and other remote scenarios for BYOK with the new copilot harness. If you are currently blocked, select the Local harness and you should see your BYOK models show up again and work

Image

vritant24 avatar Oct 05 '26 20:10 vritant24

Thanks for all the feedback. We are still looking into supporting WSL and other remote scenarios for BYOK with the new copilot harness. If you are currently blocked, select the Local harness and you should see your BYOK models show up again and work

Image

this works! thanks

sanyaji avatar Oct 06 '26 03:10 sanyaji

My workspace is on a remote Linux host (SSH to Plesk), BYOK/custom-endpoint models don't flow into the remote Agent Host. In the SSH window the model picker will only offer Auto only. And I'm in IDE mode.

thoiruddin avatar Oct 06 '26 17:10 thoiruddin

Image

select the Local harness

That doesn't work. The discussion was originally about the Agents window and connections to WSL.

PowerfulPony avatar Oct 06 '26 17:10 PowerfulPony

To work around this, I spent hours moving my development environment back to windows only to open VSCode this morning to find that I am getting this error in a chat that was working when I closed vscode. This is a chat on the windows side. NOT WSL.

Error: (modelSelectionFailed) Request session.model.switchTo failed with message: Provider model 'deepseek/deepseek-flash' is not registered

However, I open vscode agent window locally and it does work but the chat window to the same model will not work. Even on the windows side.

For the record for those reading this. If you open the editor and connect to WSL, then open an agent window session and select "local" as is suggested in an earlier reply. It will indeed enable your byok models but you will be running "locally" in windows. The agent session will be able to call into wsl but its incredibly resource heavy, or was last time I tried it.

Add to this the recent windows update that reset nearly all of my windows developer settings and this is turning into a really painful rollout for the vscode community.

It appears that changes to the underlying harness SDK is switching feature usability out from under developers with zero notice. Why else would a chat work on the WSL side when I closed the editor yesterday and fail to the same model today when I opened the editor? I may be completely wrong about that though.

The issue is that the vscode team has decided to force everyone onto the agent harness whatever you wanna call it experience. Ok, I'm fine with that as long as you FIX what you are forcing me onto before you break what I am currently using. If you can't be bothered to do that then I will find another provider that will.

tyrsson avatar Oct 06 '26 17:10 tyrsson

22. Image > select the Local harness

 That doesn't work. The discussion was originally about the Agents window and connections to WSL.

Yes sorry, I've now used to track all Copilot Harness related issues with BYOK for Remote Scenarios (WSL, Dev Containers, SSH etc) as they all follow a similar line of support as far as code goes

vritant24 avatar Oct 06 '26 18:10 vritant24

23. To work around this, I spent hours moving my development environment back to windows only to open VSCode this morning to find that I am getting this error in a chat that was working when I closed vscode. This is a chat on the windows side. NOT WSL. Error: (modelSelectionFailed) Request session.model.switchTo failed with message: Provider model 'deepseek/deepseek-flash' is not registered However, I open vscode agent window locally and it does work but the chat window to the same model will not work. Even on the windows side. For the record for those reading this. If you open the editor and connect to WSL, then open an agent window session and select "local" as is suggested in an earlier reply. It will indeed enable your byok models but you will be running "locally" in windows. The agent session will be able to call into wsl but its incredibly resource heavy, or was last time I tried it. Add to this the recent windows update that reset nearly all of my windows developer settings and this is turning into a really painful rollout for the vscode community. It appears that changes to the underlying harness SDK is switching feature usability out from under developers with zero notice. Why else would a chat work on the WSL side when I closed the editor yesterday and fail to the same model today when I opened the editor? I may be completely wrong about that though. The issue is that the vscode team has decided to force everyone onto the agent harness whatever you wanna call it experience. Ok, I'm fine with that as long as you FIX what you are forcing me onto before you break what I am currently using. If you can't be bothered to do that then I will find another provider that will.

@tyrsson Sorry about this, and thanks for the detailed write-up.

There are two separate problems here:

  1. Remote workspaces (WSL / SSH / Dev Containers) with the Copilot harness. This is still a known gap, and this issue is tracking it. When the workspace is remote, the agent host runs on the remote side, and BYOK models don't reach it yet.

  2. A Windows-local chat failing with Provider model 'deepseek/deepseek-flash' is not registered. This one is a different bug, since nothing in it is remote. From your description, the chat was created yesterday and restored today. A restored session can start before VS Code has finished registering your BYOK models with it, and then switching to the model fails. We've recently made changes so the BYOK models get registered on restored sessions before the model switch. This fix is in Insiders, and will be in Stable with 1.141

We are still working on adding support for BYOK model across all harnesses and scenarios to maintain continuity.

vritant24 avatar Oct 06 '26 18:10 vritant24

Works for me too thanks. And the new harniess still needs more work anyway. But will check if there are other issues to report.

hamdano2 avatar Oct 06 '26 22:10 hamdano2

Just click on the magic button...

Image

kapouer avatar Oct 15 '26 14:10 kapouer

To have it working as before you need to select the "Local" mode. image.png

paq85 avatar Oct 18 '26 20:10 paq85

26. To have it working as before you need to select the "Local" mode. image.png

This is not really a solution I think: the "local" and "copilot" harnesses are two different things that behave differently, correct? People here (including me) are trying to get ollama working in the copilot harness explicitly.

jaspervandorp avatar Oct 19 '26 08:10 jaspervandorp

@jaspervandorp As far as I'm concerned, the original issue is about using local models in the Agents window within a WSL workspace, not in the regular chat.

Already run into the same issue, and it's pretty annoying tho. Remote development and the usual chat fully support BYOK and work fine (with the Local harness, btw, the Copilot harness is a different story). But as soon as you open the Agents window and WSL Workspace, the "Local" option is just gone, and you're stuck with only Copilot. Still not fixed ((

BobbyGoop avatar Oct 19 '26 21:10 BobbyGoop

28. jaspervandorp As far as I'm concerned, the original issue is about using local models in the Agents window within a WSL workspace, not in the regular chat. Already run into the same issue, and it's pretty annoying tho. Remote development and the usual chat fully support BYOK and work fine (with the Local harness, btw, the Copilot harness is a different story). But as soon as you open the Agents window and WSL Workspace, the "Local" option is just gone, and you're stuck with only Copilot. Still not fixed ((

I start to have this alert today when starting a WSL session, Bring your own key (BYOK) models aren't supported in remote Copilot sessions. It's too bad, it works in last version.

guhuajun avatar Oct 21 '26 07:10 guhuajun

Any version planned with this fix? Because now copilot harness is the default harness, so it's weird if the default harness doesn't support byok!

shiv-codegit avatar Oct 21 '26 17:10 shiv-codegit

@vritant24 Is there an ETA for this feature to support BYOK for remote sessions? Can we get someone to help on this?

ashutosh-maheshwari avatar Oct 21 '26 22:10 ashutosh-maheshwari