Skip to content

Agent Sessions: GitHub MCP tools lost permanently after a credential failure — no retry, no reset path, no error surfaced #330837

Closed as not planned

Description

Summary

When the Agent Host's GitHub credential handoff to the Copilot CLI fails (here: the stored token was invalidated by a local keychain incident, but any token expiry/revocation should be equivalent), agent sessions lose the built-in GitHub MCP server permanently:

  1. The handoff never recovers, even after account auth is healthy again. The CLI initially retried and got 401s; after it gave up, every subsequent agent-host CLI process makes zero MCP connection attempts (no rmcp activity at all in ~/.copilot/logs/process-*.log).
  2. No affordance resets it. Everything I could find was tried without effect (details below).
  3. The failure is silent. Lanes just come up without GitHub tools; nothing in the UI, the CLI process logs, or the agent-host log indicates that the credential handoff failed.

Root-cause isolation

Agent sessions run inside the bundled Copilot CLI, spawned headless with --stdio --headless --no-auto-login. The CLI configures its built-in GitHub MCP server only after it has GitHub auth, and --no-auto-login disables all ambient auth, so credentials can only arrive over the IDE's stdio bridge. Running the same bundled binary standalone (node .../@github/copilot-darwin-arm64/index.js):

Mode Auth GitHub MCP
default, -p prompt gh-CLI keyring fallback (debug: [rust:copilot_runtime::auth::gh] GitHub CLI authenticated with valid token) works: github-mcp-server-* tools discovered, API calls succeed
--no-auto-login "No authentication information found" none
--no-auto-login + valid COPILOT_GITHUB_TOKEN same error: env tokens ignored in this mode none

So client, endpoint, account, and machine are all healthy; only the IDE-side credential push into the CLI is broken.

Recovery attempts (all ineffective for agent sessions)

  • Full GitHub account sign-out/sign-in in VS Code (all consumers re-prompted, account healthy afterwards) + full relaunch.
  • Disable → re-enable of the built-in GitHub server (Agent Customizations → MCP Servers). Its context menu offers nothing else: no authenticate, sign-in, or restart action.
  • MCP: List Servers → GitHub → Start Server: the editor/chat server starts cleanly ("Discovered 47 tools", no auth challenge) — but agent sessions don't route through it.
  • Authentication: Remove Dynamic Authentication Providers: reports none exist.
  • Settings variations: github.copilot.chat.githubMcpServer.enabled: true, github.copilot.chat.cli.mcp.enabled: false (each followed by a relaunch).
  • Account MCP policy verified healthy: mcpAccess: "allow_all".

Verification after each attempt: a fresh agent session's tool inventory (no github-* tools) and the newest CLI process log (zero MCP activity).

Expected

  • The credential handoff retries once account auth is healthy again, instead of giving up permanently.
  • Some user-visible way to reset/re-trigger it (a re-auth action on the server entry, or an effect from account sign-in).
  • When the handoff fails, an error surfaces: in the server list UI, the session, or at least the CLI/agent-host logs.

Timeline and log evidence (401 era → silent era) in #327640 comment; can provide full logs privately.

Activity

  1. TylerLeonhardt commented on Sep 19, 2026

    @TylerLeonhardt
    Member

    Can you please try out VS Code Insiders? There's a change in the Copilot SDK that I think may have fixed this.

  2. added
    info-needed
    on Sep 19, 2026
  3. vs-code-engineering commented on Sep 26, 2026

    @vs-code-engineering
    Contributor

    This issue has been closed as it has been labeled with info-needed and has not received the additional information that was requested from the issue author. It has been labeled as info-needed for 7 days.

  4. chalin commented on Nov 27, 2026

    @chalin
    Author

    TylerLeonhardt Sorry for the slow reply: I missed the info-needed window.

    Confirming the main symptom is resolved: agent sessions have the built-in GitHub MCP server again.

    • Environment: VS Code 1.148.0 (661626d, stable), Copilot Chat extension 0.76.0 (bundled), bundled Copilot CLI (@github/copilot) 1.0.114.r45286541461.g05667ac, macOS 27.2.1.
    • Verified today in two agent sessions, one of them freshly spawned, and again after a full VS Code relaunch: the github-mcp-server-* tools are available, and authenticated issue_read calls against this issue succeed.
    • Not tested: the recovery path itself. I haven't re-triggered a credential failure, so I can't say whether the handoff now retries or whether a failure would surface an error.

    One log observation, in case it's useful. The host process logs (~/.copilot/logs/process-*.log) from before and after the relaunch each have this line two or three times within a few seconds of process start:

    [ERROR] [rust:mcp_discovery::github_configuration] failed to configure GitHub MCP server after authentication {"error":"MCP session host was replaced during reload"}
    

    Those are the only GitHub MCP lines in either log, yet the tools work, so the log reads as a failure when it isn't one. The same line is in two process logs from the previous two days.

    Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions