github / github/copilot-cli

GitHub Copilot CLI session state management failure - ENOENT error when trying to update plan.md file

Open
#1,111 0 comments 0 reactions 0 assignees View on GitHub
area:installation area:sessions
Dominant language
Shell
Stars
11.2k
Forks
1.9k
Avg merge
14h 16m
Merged PRs (30d)
6

Description

### Describe the bug

# πŸ› Bug Report / πŸ“‹ Issue Summary

**Brief Description:**
GitHub Copilot CLI session state management failure - ENOENT error when trying to update plan.md file

# πŸ“ Environment Information

- **Operating System:** Linux
- **Software Version:** GitHub Copilot CLI v0.0.394 (Commit: 3d79feb)
- **Browser/Runtime:** Terminal/CLI environment
- **Additional Environment Details:**
- Session ID: [session-id-redacted]

# πŸ” Steps to Reproduce

1. Start GitHub Copilot CLI development session
2. Complete development tasks successfully
3. Copilot CLI triggers context window compaction/summarization
4. Context window update completed
5. Copilot CLI attempts to update session state plan.md file
6. Error occurs when trying to edit the plan.md file

# πŸ“‹ Expected Behavior

Copilot CLI should successfully update its internal session state files (plan.md) after completing development phases, allowing the workflow to continue smoothly.

# ❌ Actual Behavior

Copilot CLI fails to update the plan.md file with an ENOENT (file not found) error, interrupting the development workflow despite successful completion of the actual development tasks.

# πŸ“Š Error Logs

```
βœ— Edit .github/copilot/session-state/52770d1f-ed4c-4567-82b1-48948bed0ba4/plan.md
Unhandled error: Error: ENOENT: no such file or directory, open
'/path/to/project/.github/copilot/session-state/[session-id]/plan.md'
```

**Session Context:**
```
βœ— Create backend/container/internal/trace/context_test.go
Path not absolute

βœ“ Development tasks completed successfully

● Summarizing conversation to fit within context window.
Compaction completed
β”” press ctrl+o to view summary

● Conversation summary finished and context window updated.

βœ— Edit .github/copilot/session-state/[session-id]/plan.md
Unhandled error: Error: ENOENT: no such file or directory
```

# πŸ–ΌοΈ Screenshots/Additional Evidence

**Session State Directory Structure Issue:**
- Expected path: `~/.copilot/session-state/[session-id]/plan.md`
- Actual attempted path: `/path/to/project/.github/copilot/session-state/[session-id]/plan.md`

**Timeline:**
- βœ… Development tasks completed successfully
- πŸ”„ Context window compaction/summarization triggered
- βœ… Context window update completed
- ❌ Session state update failed immediately after

# πŸ”§ Possible Solution

1. **Context Window Operation Issue:** The error occurred immediately after a context window compaction/summarization operation, suggesting the context update process may have corrupted session state management
2. **File Path Resolution Issue:** Copilot CLI might be incorrectly constructing the path to session state files after context updates
3. **Session State Persistence Bug:** Context window updates might not properly preserve session state file references

**Suggested Fixes:**
- Ensure session state file references are properly preserved during context window operations
- Validate and restore session state paths after context compaction
- Add proper error handling for session state file operations post-context updates

# πŸ“š Additional Context

This error occurred during a development session where all actual development tasks completed successfully. The issue is specifically with Copilot CLI's internal session state management after a context window compaction operation, suggesting the context summarization process may interfere with session state file tracking.

The error suggests a mismatch between where Copilot CLI expects to find session state files and where it's actually looking for them.

---

### πŸ“‹ Checklist

- [x] I have searched existing issues to confirm this is not a duplicate
- [x] I have provided complete error logs
- [x] I have provided reproduction steps
- [x] I have described the expected behavior

### 🏷️ Labels

**Suggested Labels:** `bug`, `cli`, `session-management`, `file-system`, `copilot-cli`, `context-window`

### Affected version

0.0.394 Commit: 3d79feb

### Steps to reproduce the behavior

_No response_

### Expected behavior

_No response_

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.