Skip to content

[Bug]: Claude Code session import skips long sessions (transcript over 32 MiB memory budget) #29153

Closed

Description

@Brok3d3ad

Before submitting

Area

apps/server (Claude Code session import / AgentSessionImporter)

Steps to reproduce

  1. Have a long-running Claude Code session whose transcript ~/.claude/projects/<encoded-cwd>/<sessionId>.jsonl is over 32 MiB. Sessions that run for days and auto-compact many times grow well past that.
  2. Import Claude Code sessions for that project (agentSessions.import, through the /welcome wizard or a direct RPC call).

Expected behavior

The session is imported, and continuing it resumes the native Claude Code session (resume: <sessionId>), just like claude --resume <sessionId> in the terminal.

Actual behavior

The session is skipped on every run and counted in skippedCount. The server trace logs:

Could not read imported transcript … Transcript selected history exceeds the 32 MiB memory budget

The UI doesn't say why the session is missing.

Impact

Long-running sessions are the ones people most want to move into T3 Code, and they're exactly the ones that can't be imported. My main working session is 1.6 GB (about 305k lines). Another user on #10961 reported 57 MB, 76 MB and 107 MB sessions skipped on every run.

Version or commit

T3 Code desktop 0.1.6 (Beta). Claude Code CLI 2.1.316.

Environment

Windows 11, desktop app, default Claude Code provider instance (~/.claude).

Logs or stack traces

See above, as reported in #10961.

Suggested direction

  1. Read the transcript in a streaming way with a bounded window. The parser only keeps the first user message and the last ~199 messages anyway. Keeping a rolling window of recent records while reading, instead of everything up to the budget, would let any size import. Alternatively, start from the last compact_boundary record.
  2. Don't load the full history for Claude threads at all. The model's context comes from the native resume (resume: <sessionId>), so the importer needs only enough to show recent history and a title. This also fits the note on [Bug]: Imported Claude Code threads fail on their first follow-up with "Session ID … is already in use" #15243 that the manual_context handoff is redundant for resumed Claude threads.
  3. Say why a session was skipped, for example "too large", "changed during read (still open in Claude Code)" or "older than 30 days".

Workaround

None in the app. The only way I found is to edit statev2.sqlite with T3 closed, pointing an existing Claude thread's nativeThreadRef.nativeId (and the matching provider-thread.updated / run-attempt.updated events) at the large session's ID. That isn't something users should have to do.

Related

Drafted with Claude Opus 5.5 in T3 Code.

Activity

  1. Abirouk commented on Nov 6, 2026

    @Abirouk

    Two things about this budget from reading AgentSessionScanner.readTranscript and AgentSessionJson.createTranscriptJsonReader on main, checked against a transcript of mine.

    The budget is not message text. The reader charges 64 bytes per selected JSON token plus two bytes per character of selected strings, and two bytes per character of every key in the record, selected or not. historyBytes grows by that amount for each record shouldRetainDecodedRecord keeps and never resets, so it accumulates over the whole file, not over the 200 messages the import keeps. Applying that accounting to a 34.5 MiB transcript of mine (about 2,980 lines, 62 retained user and assistant records, 23 KB of visible text) gives about 0.32 MiB, roughly 4.5 KB per retained record before any text. At that rate about 7,500 retained records exhaust 32 MiB with no text at all, so a long session trips the budget on record count. That is why the rolling window in the suggested direction would hold up where a bigger budget would only move the record count.

    The 1.6 GB file in the report is also about 305k lines, which is over MAX_IMPORT_RECORDS (100,000). Once the budget stops throwing, that cap skips the same file silently (#31677), so both limits need to change for this transcript to import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions