[BUG] v2.1.50 Regression: Completed tasks nuked from disk — memory leak fix deletes task files instead of freeing references
Bug Description
In v2.1.50, marking a task as completed via TaskUpdate causes the task JSON file to be immediately removed from ~/.claude/tasks/<session-id>/. Calling TaskList afterward shows no completed tasks. They are gone, not just hidden.
This is a regression. In v2.1.49 and earlier, completed tasks remained visible in TaskList with [completed] status and their JSON files persisted on disk.
Steps to Reproduce
- Start a fresh session on v2.1.50 (not a resumed session)
- Create a task:
TaskCreate { subject: "Test task", description: "Testing" } - Mark it completed:
TaskUpdate { taskId: "1", status: "completed" } - Call
TaskList— task is gone - Check disk:
ls ~/.claude/tasks/<session-id>/— only.lockand.highwatermark, no task JSON files
Expected Behavior
Completed tasks remain in TaskList with status completed and persist on disk as JSON files in ~/.claude/tasks/<session-id>/.
Actual Behavior
Completed task JSON files are deleted from disk immediately upon completion. TaskList returns no record of them.
Key Observations
- Resumed sessions from pre-v2.1.50 are NOT affected — their completed tasks persist normally. Only fresh v2.1.50 sessions exhibit this behavior.
- The
.highwatermarkfile appears only in v2.1.50 task directories and may be related. - Tested across multiple agents and projects — all fresh v2.1.50 sessions are affected.
status: "completed"is confirmed via transcript analysis — agents are NOT callingstatus: "deleted".
Likely Cause
v2.1.50 includes three task-related memory leak fixes:
- "Fixed memory leak where completed task state objects were never removed from AppState"
- "Fixed memory leak where completed task output was not freed from memory"
- "Fixed memory leak where TaskOutput retained recent lines after cleanup"
The first fix appears to be removing completed task files from disk rather than only freeing in-memory references.
Environment
- Platform: Linux (Ubuntu, x86_64)
- Version: 2.1.50
- Model: Claude Opus 4.6
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗