CC tasks disappear from TUI after /compact (session ID not preserved)
Summary
After running \/compact\ (explicit manual compaction), open CC tasks stop appearing in the TUI task panel. The tasks are still accessible via \TaskList\ tool (which searches across all session directories), but the TUI panel shows nothing because it scopes to the current session ID.
This appears to be a regression. Manual \/compact\ and automatic compaction have been used regularly in this project without ever causing tasks to disappear from the TUI. This is the first time this behavior has been observed, so something may have changed recently that broke session ID continuity across compaction.
Steps to Reproduce
- Create one or more CC tasks via \
TaskCreate\during a session - Verify tasks appear in the TUI panel (checkbox list)
- Run \
/compact\explicitly - Observe: TUI task panel is now empty
- \
TaskList\tool still returns the tasks, but they are stored under the pre-compaction session ID
Root Cause (hypothesis)
Tasks are stored at \~/.claude/tasks/{session_id}/{task_id}.json\. It appears that in this instance, \/compact\ generated a new session ID for the post-compaction context. Normally (in prior usage), compaction — both manual and automatic — preserves the existing session ID, so this issue has not occurred before. Something appears to have changed that caused the session ID to not be preserved this time.
Session Identifiers (for log lookup)
- Pre-compaction session ID: \
548da1ba-a693-4aab-b482-086942faada0\(where orphaned tasks are stored) - Claude Code version: 2.1.122
- Platform: macOS (darwin 25.4.0)
- Shell: zsh
- Project type: git worktree
Expected Behavior
Session ID-scoped tasks are the right design — this keeps tasks isolated per session, which is correct when running parallel CC sessions in the same project. The bug is simply that \/compact\ is not reliably preserving the session ID. Prior to this instance, compaction (both manual and automatic) consistently preserved the session ID and tasks remained visible in the TUI. The fix should ensure that \/compact\ never causes a new session ID to be generated, restoring the previously reliable behavior.
Workaround
Recreate tasks using \TaskCreate\ in the new session after compaction. Old task files remain on disk under the previous session ID and can be read to recover task content.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗