MCP servers reported as "blocked by policy" on first launch when using a custom config directory
- Ngôn ngữ chính
- Shell
- Star
- 11.2k
- Fork
- 1.9k
- Merge trung bình
- 14 giờ 16 phút
- Pull request đã merge (30 ngày)
- 6
Mô tả
### 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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện luồng khởi chạy lần đầu với một thư mục cấu hình không mặc định và theo dõi quá trình khởi tạo MCP cùng với việc tìm nạp không đồng bộ chính sách doanh nghiệp từ máy chủ GHE. Được coi là hoàn thành khi các máy chủ MCP tải đúng trong lần khởi chạy đầu tiên mà không cần một tin nhắn và /restart, đồng thời có kiểm thử hồi quy cho trường hợp thiếu session-store.db.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- shell
- Lĩnh vực
- cli
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100