github / github/copilot-cli

Store session state under project `.copilot/` directory to support ephemeral home directories (Docker, CI, devcontainers)

Ouverte
#3,021 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub
area:configuration area:sessions
Langage dominant
Shell
Étoiles
11.2k
Forks
1.9k
Merge moyen
14 h 16 min
PR mergées (30 j)
6

Description

### Problem

When running Copilot CLI inside a Docker container, devcontainer, or CI runner, the home directory (`~/.copilot/session-state/`) is ephemeral — it is lost when the container exits. This makes `/session restore SESSION_ID` permanently unavailable after the container shuts down, even if the working project directory is a persistent volume mount or git checkout.

The session state that gets lost includes:
- The event log (`events.jsonl`) needed for session restore
- Checkpoints and their index
- Any session artifacts written to the session folder

### Proposed solution

Allow the runtime to store (or mirror) session state under a `.copilot/session-state/` directory inside the project working directory, rather than exclusively under `~/.copilot/session-state/`.

A reasonable implementation:

1. If a `.copilot/` directory exists in the current working directory when a session starts, store session state there instead of (or in addition to) `~/.copilot/session-state/`.
2. When resolving a session ID for `/session restore`, also search `.copilot/session-state/` in the cwd.
3. Optionally: support a config option or environment variable (e.g. `COPILOT_SESSION_DIR`) to explicitly override the storage root.

The `.copilot/` directory in the project can already be used as home for agent-created artifacts (like `plan.md`). Keeping session state there as well makes the whole session context co-located with the code it relates to, and committable to git if desired.

### Relation to existing issues

Issue #1947 requests cloud-synced sessions for cross-device continuity. This request is narrower — it only requires the runtime to look in an additional local directory, with no network dependency.

### Environment

Any environment where `$HOME` is not persistent: Docker containers, GitHub Codespaces rebuilds, CI runners, devcontainers.

Suggested label: area:sessions

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Begin by locating the session-state writer and the `/session restore` lookup; the issue names no source files or tests. Check behavior in a persistent project directory with an ephemeral home, including existing `.copilot/session-state/` and the proposed `COPILOT_SESSION_DIR` override. Done means session state is stored or found as specified and restore works after the home directory is discarded.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
docker, shell
Domaine
cli, devops, infrastructure
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Calme
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.