Skip to content

[BUG] Context silently truncated on session resume despite autoCompactEnabled: false — 1,232 messages / 2 days of active work dropped from context #40487

Closed as duplicate

Description

@privitera

[BUG] Context silently truncated on session resume despite autoCompactEnabled: false — 1,232 messages / 2 days of active work dropped from context

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

1,232 messages spanning 2 days of active work are silently excluded from the context window on session resume. Context dropped from ~500k tokens to ~120k tokens. Claude cannot reference or recall any of the excluded content.

The data is intact in the session JSONL file. This is a resume-time loading bug, not data loss.

This occurs despite autoCompactEnabled: false being explicitly set in ~/.claude.json.

Root Cause

The session JSONL stores messages as a linked list via parentUuid → uuid. On resume after an SSH drop, a duplicate user message was appended to the end of the file with the same uuid as a message already present earlier in the file. This creates a fork:

Line 287 (assistant, uuid=e46c07fb)
  ├─ Line 288 (assistant) → Line 290 (user) → ... → 2,000+ lines of real work
  ├─ Line 289 (user, uuid=ca566d54)           ← original, leads to real work chain
  └─ Line 2372 (user, uuid=ca566d54)          ← DUPLICATE appended on resume
       └─ Line 2373 (assistant, "No response requested.")  ← synthetic placeholder
            └─ Line 2374+ → what the loader actually follows

Lines 289 and 2372 share the same uuid (ca566d54). The loader appears to deduplicate by uuid using last-write-wins, lands on the duplicate at line 2372, follows it to a synthetic "No response requested." placeholder (line 2373, which has isApiErrorMessage in its keys), and continues from there. The entire branch through line 288 — containing all 1,232 messages of real work — is orphaned.

How This Happened

The session was run over SSH without tmux/screen. The laptop sleeping caused SSH drops, killing the Claude Code process. Each gap was followed by claude --continue to resume. There are 8 such drops within the affected range.

Gap Duration Period
1 6.4 hr Thu 2:49 PM → Thu 9:10 PM
2 11.1 hr Thu 11:29 PM → Fri 10:36 AM
3 2.8 hr Fri 11:56 AM → Fri 2:44 PM
4 1.2 hr Fri 2:44 PM → Fri 3:55 PM
5 2.6 hr Fri 5:03 PM → Fri 7:37 PM
6 2.4 hr Fri 8:01 PM → Fri 10:22 PM
7 9.3 hr Fri 11:20 PM → Sat 8:38 AM
8 6.8 hr Sat 8:38 AM → Sat 3:26 PM

Suggested Fix

Two separate issues need addressing:

  1. Resume should not append duplicate messages. If a user message with a given uuid already exists in the session JSONL, --continue should not write a second copy. This prevents the fork from being created in the first place.

  2. The linked list walker should prefer the branch with more descendants (or the one with real assistant responses, not synthetic isApiErrorMessage placeholders). Even if a fork exists, the loader should follow the branch containing 1,232 messages of real work, not the branch containing a single synthetic "No response requested."

Possible Contributing Factor

An undocumented feature flag in cachedGrowthBookFeatures in ~/.claude.json may also be involved:

"tengu_slate_heron": {
  "enabled": true,
  "gapThresholdMinutes": 70,
  "keepRecent": 5
}

This was delivered server-side via Statsig/GrowthBook with no documented opt-out. All 8 SSH-drop gaps exceed 70 minutes. I do not have access to source code to confirm what this flag does, but the parameter names are suggestive. The Anthropic team can confirm or deny whether this flag interacts with the resume/fork behavior.

Workaround (Untested)

Deleting lines 2372 and 2373 from the session JSONL should eliminate the duplicate fork point. The loader would then follow line 288 → 289 → ... through the real work chain. I haven't tested this yet.

Steps to Reproduce

  1. Start a session over SSH without tmux
  2. Build up significant context (~500k tokens)
  3. Allow SSH to drop (laptop sleep) — Claude Code process is killed mid-session
  4. Resume with claude --continue
  5. Repeat steps 3–4 multiple times
  6. Eventually, context drops and earlier work disappears from the conversation
  7. Inspect the session JSONL — look for duplicate uuid entries creating a fork in the parentUuid chain

Expected Behavior

  • --continue after unclean termination should never append duplicate messages
  • If forks exist in the linked list, the loader should follow the branch with real content
  • When autoCompactEnabled: false is set, no context should be silently dropped under any circumstances
  • If context cannot be fully loaded, a visible indicator should be shown

Environment

  • Claude Code version: 2.1.87
  • Platform: Linux
  • Install method: native (~/.local/bin/claude)
  • Model: claude-opus-4-6 (1M context)
  • autoCompactEnabled: false (set via claude config set -g)
  • tengu_slate_heron.enabled: true (server-assigned, undocumented, no opt-out)
  • Session run over SSH without tmux (repeated unclean process terminations)

Related Issues

Note

The session referenced in this report involves proprietary work on a private project. I'm happy to provide the session JSONL to Anthropic engineers privately for debugging, but please do not request that it be shared publicly. The session ID and timestamps above should be sufficient to reproduce the loading behavior independently.

Activity

  1. github-actions commented on Mar 29, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. [BUG] Session resume loads zero conversation history — silently drops all context #40319
    2. Session resume drops ~18k tokens of context with no compact_boundary #35358
    3. [BUG] Session context truncated at version boundary after /exit when reopening in 2.1.85 #39856

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. added
    duplicateThis issue or pull request already exists
    and removed
    bugSomething isn't working
    has reproHas detailed reproduction steps
    platform:linuxIssue specifically occurs on Linux
    on Apr 1, 2026
  3. github-actions commented on Apr 1, 2026

    @github-actions

    This issue has been automatically closed as a duplicate of #40319.

    If this is incorrect, please re-open this issue or create a new one.

    🤖 Generated with Claude Code

  4. privitera commented on Apr 6, 2026

    @privitera
    Author

    This is not a duplicate.

  5. github-actions commented on Apr 14, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  6. locked as resolved and limited conversation to collaborators on Apr 14, 2026
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

    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