Session name lost after context compaction

Resolved 💬 1 comment Opened Feb 16, 2026 by OurxD Closed Feb 16, 2026

Description

When a session is renamed via /rename, the name is lost after context compaction occurs. The session name gets overridden with [Request interrupted by user for tool use] instead of preserving the original name.

Root Cause

Session names are stored as custom-title events in the session's JSONL file. When context compaction creates a new continuation session, the custom-title event is not carried over to the new session's JSONL file.

Original session (aaaa-bbbb-...):

{
  "type": "custom-title",
  "customTitle": "my-feature-branch",
  "sessionId": "aaaa-bbbb-..."
}

Continuation session (cccc-dddd-...): No custom-title event present. The session picker then falls back to using the first user message as the title, which after compaction is [Request interrupted by user for tool use].

Steps to Reproduce

  1. Start a Claude Code session
  2. Rename it with /rename my-feature-branch
  3. Continue working until the conversation hits the context limit and compaction triggers
  4. Observe the session name in the session picker has changed to [Request interrupted by user for tool use]

Expected Behavior

The custom-title event should be copied to the continuation session's JSONL file during context compaction, preserving the user's chosen name.

Actual Behavior

The custom-title event only exists in the original session file. The continuation session has no title, so it falls back to the first message text which is the compaction summary preamble.

Related Issues

  • #25999 — Persistent state across context compaction
  • #19494 — /rename command not recognized after context compaction

Environment

  • Claude Code CLI
  • Model: claude-opus-4-6
  • Platform: macOS (Darwin 24.6.0)

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗