github / github/copilot-cli

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

Aperta
#2,836 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
area:sessions
Lingua principale
Shell
Stelle
11.2k
Fork
1.9k
Merge medio
14h 16m
PR unite (30g)
6

Descrizione

### 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

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia tracciando l’inizializzazione della sessione e il comportamento di ripresa su Windows, quindi esamina come vengono create le cartelle che contengono solo lo scaffold con workspace.yaml e checkpoints/index.md. Il lavoro è completato quando un avvio interrotto o incompleto non lascia più cartelle prive di events.jsonl o session.db e le sessioni valide rimangono visibili e ripristinabili tramite copilot --resume.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
shell
Ambito
cli
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
55/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.