github / github/copilot-cli

MCP servers reported as "blocked by policy" on first launch when using a custom config directory

未關閉
#2,567 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area:configuration area:enterprise area:mcp
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### Describe the bug

When launching Copilot CLI with a non-default config directory, MCP servers are incorrectly reported as "blocked by policy". Sending one message and restarting (/restart) fixes it for that session.

### Affected version

1.0.20

### Steps to reproduce the behavior

1. Launch Copilot CLI with a non-default config directory (e.g. via env var pointing to a custom ~/.copilot-/ folder)
2. Observe that MCP servers are reported as blocked by policy immediately on startup
3. Send one message, then /restart
4. MCP servers now load correctly

### Expected behavior

MCP servers load on first launch.

### Additional context

Root cause hypothesis: The custom config dir has no session-store.db, so there is no cached policy state. The CLI appears to have a race condition where MCP initialization completes
before the async enterprise policy fetch from the GHE host finishes — defaulting to "blocked" instead of waiting for the result.

Workaround: One message + /restart resolves it for that session.

貢獻指南

開啟貢獻指南

研究方向

Start by reproducing the first-launch flow with a non-default config directory and trace MCP initialization alongside the asynchronous enterprise policy fetch from the GHE host. Done means MCP servers load correctly on the initial launch without requiring a message and /restart, with regression coverage for a missing session-store.db.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
shell
領域
cli
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。