github / github/copilot-cli

Copilot CLI leaves behind orphaned session-state scaffold folders during aborted or incomplete session initialization/resume.

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

描述

### Describe the bug

Copilot CLI leaves behind orphaned session-state scaffold folders during aborted or incomplete session initialization/resume.

These folders appear under ~/.copilot/session-state and contain minimal scaffold files like workspace.yaml, checkpoints/index.md, and empty checkpoints/, files/, and research/ directories, but they do not contain real session data like events.jsonl or session.db.

This causes the on-disk session corpus to diverge from what appears in copilot --resume.

### Affected version

1.0.32

### Steps to reproduce the behavior

1. Use Copilot CLI on Windows.
2. Start or attempt to resume sessions repeatedly, including cases where session startup/resume does not fully complete.
3. Inspect ~/.copilot/session-state.
4. Observe folders that contain workspace.yaml, checkpoints/index.md, and empty checkpoints/, files/, and research/ directories.
5. Observe that these folders do not contain events.jsonl or session.db.
6. Run copilot --resume and compare the visible sessions to the folders on disk.
7. See that extra scaffold folders exist on disk but are not real resumable sessions.

### Expected behavior

Session folders should only be created once initialization is durable and valid, or they should be cleaned up automatically if startup/resume aborts or fails.

### Additional context

Environment:
- Windows
- GitHub Copilot CLI 1.0.32

Observed in local session corpus:
- Multiple scaffold-only folders with summary_count: 0
- Scaffold folders contain workspace.yaml and empty directories only
- Real sessions contain events.jsonl and often session.db
- A fresh scaffold folder was created during inspection of sessions via --resume
- There was also one corrupted old session with events.jsonl but missing workspace metadata, which is a separate issue from the scaffold folders

Suggested fix:
- Delay session directory creation until first durable write, or
- create in a temp location and promote atomically, or
- automatically clean up scaffold-only folders on failed initialization

貢獻指南

開啟貢獻指南

研究方向

Start by tracing session initialization and resume behavior on Windows, then inspect how scaffold-only folders containing workspace.yaml and checkpoints/index.md are created. Done means aborted or incomplete startup no longer leaves folders without events.jsonl or session.db, while valid sessions remain visible and resumable through copilot --resume.

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

評估

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

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

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