vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Agents window: dev container agent host doesn't receive the GitHub Enterprise endpoint (asks for api.github.com, 'Authentication is required to start a session')

Open AntoineMaille opened this issue 1 month ago • 0 comments

Does this issue occur when all extensions are disabled?: Not applicable. The Agents window and the agent host don't use an extension host in the dev container.

  • VS Code Version: 1.143.1 (commit e646868227c3e3a9e3f24277c8c7220be42c0be7, Stable), agent host 1.143.1
  • OS Version: Windows 11 client, WSL2 Ubuntu, Dev Containers (docker compose, remoteUser: node)
  • GitHub: GitHub Enterprise Cloud with data residency (<company>.ghe.com), Copilot Business seat

Summary

In the Agents window, the agent host of a dev container doesn't get the GitHub Enterprise endpoint. It asks the client for https://api.github.com, the client has no github.com session, and chat fails with Authentication is required to start a session. The same account works on the WSL agent host. The container starts from scratch on every rebuild, so the problem comes back each time.

Steps to reproduce

  1. Configure github-enterprise.uri to https://<company>.ghe.com and sign in to GHE. Copilot works with the WSL remote.
  2. Open a folder in a dev container (Dev Containers: Reopen in Container). The container has no persistent volume for ~/.vscode-server.
  3. Use the Agents window and start a chat on the devcontainer agent host.

Expected

The container agent host targets the GHE host and gets the GHE token, as the WSL one does.

Actual

Container agent host log (agenthost.log) after startup. There is no GitHub endpoints changed, no Startup config changed (enterpriseHost=...), no Set CLI env: COPILOT_GH_HOST=... and no Auth token updated:

[info] Agent Host process started successfully
[info] Registering agent provider: copilotcli
[info] [Copilot] Starting CopilotClient...
[info] [Copilot] Set CLI env: GITHUB_COPILOT_INTEGRATION_ID=vscode-chat
[info] [Copilot] CopilotClient started successfully

Client log (renderer.log) right after connecting to the container:

[RemoteAgentHost] Connected to devcontainer:<id>
[RemoteAgentHost] No signed-in session resolved for resource: https://api.github.com
[RemoteAgentHost] No signed-in session resolved for resource: https://api.github.com/repos
... (repeated over 200 times)
[RemoteAgentHost] Interactive authentication did not provide a token for https://api.github.com
Error while handling chat request: Authentication is required to start a session. Please sign in and try again.

For comparison, the WSL agent host on the same machine receives the endpoint:

[AgentHost] GitHub endpoints changed (api=https://api.<company>.ghe.com)
[Copilot] Startup config changed (enterpriseHost=<company>.ghe.com), restarting CopilotClient
[Copilot] Set CLI env: COPILOT_GH_HOST=<company>.ghe.com
[Copilot] Auth token updated

User/globalStorage/agent-host-config.json:

  • WSL: contains "githubEnterpriseUri": "https://<company>.ghe.com"
  • Dev container, freshly created: no githubEnterpriseUri key

In an earlier container, GitHub endpoints changed (api=https://api.<company>.ghe.com) appeared in the container agent host log about a minute after I tried to edit its settings (agent-host-settings://agenthost-devcontainer__<id>/settings.jsonc). Saving that file failed twice with Failed to parse agent host settings as JSON. After the next container rebuild, the freshly created container had no githubEnterpriseUri again.

Intermittently, the WSL agent host also starts before the endpoint is applied: in one session Not authenticated / Authentication is required to use Claude/Codex errors went on for about 20 minutes until Startup config changed (enterpriseHost=...) appeared.

Analysis

This is a guess based on the logs, I haven't read the code. #324159 added an agent host GHE endpoint service, but the endpoint seems to be applied only to an agent host that already has githubEnterpriseUri in its own config. A newly created remote or container agent host doesn't get it from the client's github-enterprise.uri setting.

Related

  • #313396 / #324159: GHE support in the agent host
  • #337485 / #337562: GHE auth loop in the Agents window (fixed in 1.140)
  • #338596: Authentication loop and Bad credentials with GHE

AntoineMaille avatar Oct 26 '26 15:10 AntoineMaille