claude-code - 💡(How to fix) Fix CC tasks disappear from TUI after /compact (session ID not preserved) [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54508Fetched 2026-04-30 06:43:43
View on GitHub
Comments
3
Participants
3
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×3

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.

Root Cause

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.

Fix Action

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.

RAW_BUFFERClick to expand / collapse

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

  1. Create one or more CC tasks via `TaskCreate` during a session
  2. Verify tasks appear in the TUI panel (checkbox list)
  3. Run `/compact` explicitly
  4. Observe: TUI task panel is now empty
  5. `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.

extent analysis

TL;DR

The most likely fix is to modify the /compact command to preserve the existing session ID, ensuring tasks remain visible in the TUI panel after compaction.

Guidance

  • Verify that the session ID is being generated correctly before and after compaction by checking the ~/.claude/tasks/{session_id}/{task_id}.json files.
  • Investigate the changes made to the /compact command or the session ID generation logic to identify what caused the regression.
  • Consider adding a check to ensure that the session ID is preserved during compaction, potentially by passing the current session ID as an argument to the /compact command.
  • Test the workaround of recreating tasks using TaskCreate in the new session after compaction to confirm that it resolves the issue.

Example

No code snippet is provided as the issue does not specify the implementation details of the /compact command or the session ID generation logic.

Notes

The fix may require changes to the underlying logic of the /compact command or the session ID generation mechanism, which could have unintended consequences. Thorough testing should be performed to ensure that the fix does not introduce new issues.

Recommendation

Apply a workaround by modifying the /compact command to preserve the existing session ID, as this is the most direct way to address the regression and restore the previously reliable behavior.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING