Skip to content

Web→CLI teleported sessions not appearing in Resume Session list #28039

Description

@negai-chu

Bug description

Sessions teleported from Claude Code Web (claude.ai/code) to the local CLI sometimes don't appear in the Resume Session picker (claude -r / /resume).

Root cause

The session .jsonl file's first line has type: "file-history-snapshot" instead of a session-type entry. The actual conversation data (with type: "system", type: "user", etc.) starts from line 1 onward.

It appears the session indexer (sessions-index.json) only inspects the first line of each .jsonl file to determine whether it's a session. When it sees file-history-snapshot, it skips the file entirely — even though valid session data exists in subsequent lines.

Line 0: {"type": "file-history-snapshot", ...}       ← indexer stops here
Line 1: {"type": "system", "sessionId": "004cc9d6-...", "gitBranch": "claude/fix-toc-formatting-Px8XU", "slug": "sharded-sleeping-pebble", "compactMetadata": {...}, ...}
Line 2: {"type": "user", "sessionId": "004cc9d6-...", ...}
Line 3: {"type": "assistant", "sessionId": "004cc9d6-...", ...}
...

Steps to reproduce

  1. Start a session on Claude Code Web (claude.ai/code)
  2. Work for a while (long enough for auto-compaction to trigger)
  3. Teleport the session to the local CLI
  4. Complete the work and exit
  5. Try to resume with claude -r — the session does not appear in the list

Expected behavior

Teleported sessions should be registered in sessions-index.json and appear in the Resume Session picker, regardless of the first line's type in the .jsonl file.

Environment

  • Claude Code CLI version: 2.1.49 (version at time of teleport)
  • OS: macOS (Darwin 25.3.0)

Additional context

  • The session data is fully intact in the .jsonl file — it's only the index that's missing the entry
  • The compactMetadata field suggests the web session was auto-compacted before teleport, which may be related to the write order issue
  • Out of 87 .jsonl files in the project directory, only 29 were indexed — 68 were orphaned (most are file-history-snapshot type)

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions