github / github/copilot-cli

Config file race condition when running multiple CLI sessions simultaneously

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

描述

When running multiple Copilot CLI sessions concurrently, changes to ~/.copilot/config.json made by one session are
overwritten by other sessions, resulting in loss of configuration changes.

Steps to reproduce:

1. Start Copilot CLI session 1 in terminal window A
2. Start Copilot CLI session 2 in terminal window B
3. In session 1, make a configuration change (e.g., add a trusted folder with /add-dir)
4. In session 2, make a different configuration change (e.g., add an allowed URL)
5. Check ~/.copilot/config.json - only the last change persists, the first change is lost

Expected behavior:

Configuration changes from all sessions should be merged or preserved. Ideally:

- Use file locking to prevent concurrent writes
- Watch the config file for external changes and reload when modified
- Merge changes from multiple sessions intelligently

Actual behavior:

Each CLI session reads config.json on startup, holds it in memory, and writes the entire file back on changes,
overwriting any modifications made by other sessions.

Environment:

- Copilot CLI version:
0.0.402
- OS: Windows (but likely affects all platforms)

Suggested solutions:

1. Implement file locking (flock/LockFile) during config writes
2. Add file watching to detect external changes and prompt user to reload
3. Use atomic read-modify-write operations with retry logic on conflicts
4. Store session-specific settings separately from global config

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

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

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