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

Resolved 💬 4 comments Opened Mar 29, 2026 by privitera Closed Apr 1, 2026

<html>
<body>
<!--StartFragment--><html><head></head><body><h1>[BUG] Context silently truncated on session resume despite <code>autoCompactEnabled: false</code> — 1,232 messages / 2 days of active work dropped from context</h1>
<h2>Preflight Checklist</h2>
<ul>
<li>[x] I have searched existing issues and this hasn't been reported yet</li>
<li>[x] This is a single bug report (please file separate reports for different bugs)</li>
<li>[x] I am using the latest version of Claude Code</li>
</ul>
<h2>What's Wrong?</h2>
<p>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.</p>
<p><strong>The data is intact in the session JSONL file. This is a resume-time loading bug, not data loss.</strong></p>
<p>This occurs despite <code>autoCompactEnabled: false</code> being explicitly set in <code>~/.claude.json</code>.</p>
<h2>Root Cause</h2>
<p>The session JSONL stores messages as a linked list via <code>parentUuid → uuid</code>. On resume after an SSH drop, a <strong>duplicate user message</strong> was appended to the end of the file with the same <code>uuid</code> as a message already present earlier in the file. This creates a fork:</p>
<pre><code>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
</code></pre>
<p>Lines 289 and 2372 share the same <code>uuid</code> (<code>ca566d54</code>). 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 <code>isApiErrorMessage</code> in its keys), and continues from there. The entire branch through line 288 — containing all 1,232 messages of real work — is orphaned.</p>
<h2>How This Happened</h2>
<p>The session was run over SSH <strong>without tmux/screen</strong>. The laptop sleeping caused SSH drops, killing the Claude Code process. Each gap was followed by <code>claude --continue</code> to resume. There are 8 such drops within the affected range.</p>

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

<h2>Suggested Fix</h2>
<p>Two separate issues need addressing:</p>
<ol>
<li>
<p><strong>Resume should not append duplicate messages.</strong> If a user message with a given <code>uuid</code> already exists in the session JSONL, <code>--continue</code> should not write a second copy. This prevents the fork from being created in the first place.</p>
</li>
<li>
<p><strong>The linked list walker should prefer the branch with more descendants</strong> (or the one with real assistant responses, not synthetic <code>isApiErrorMessage</code> 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."</p>
</li>
</ol>
<h2>Possible Contributing Factor</h2>
<p>An undocumented feature flag in <code>cachedGrowthBookFeatures</code> in <code>~/.claude.json</code> may also be involved:</p>
<pre><code class="language-json">"tengu_slate_heron": {
"enabled": true,
"gapThresholdMinutes": 70,
"keepRecent": 5
}
</code></pre>
<p>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.</p>
<h2>Workaround (Untested)</h2>
<p>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.</p>
<h2>Steps to Reproduce</h2>
<ol>
<li>Start a session over SSH without tmux</li>
<li>Build up significant context (~500k tokens)</li>
<li>Allow SSH to drop (laptop sleep) — Claude Code process is killed mid-session</li>
<li>Resume with <code>claude --continue</code></li>
<li>Repeat steps 3–4 multiple times</li>
<li>Eventually, context drops and earlier work disappears from the conversation</li>
<li>Inspect the session JSONL — look for duplicate <code>uuid</code> entries creating a fork in the <code>parentUuid</code> chain</li>
</ol>
<h2>Expected Behavior</h2>
<ul>
<li><code>--continue</code> after unclean termination should never append duplicate messages</li>
<li>If forks exist in the linked list, the loader should follow the branch with real content</li>
<li>When <code>autoCompactEnabled: false</code> is set, no context should be silently dropped under any circumstances</li>
<li>If context cannot be fully loaded, a visible indicator should be shown</li>
</ul>
<h2>Environment</h2>
<ul>
<li>Claude Code version: 2.1.87</li>
<li>Platform: Linux</li>
<li>Install method: native (<code>~/.local/bin/claude</code>)</li>
<li>Model: claude-opus-4-6 (1M context)</li>
<li><code>autoCompactEnabled</code>: false (set via <code>claude config set -g</code>)</li>
<li><code>tengu_slate_heron.enabled</code>: true (server-assigned, undocumented, no opt-out)</li>
<li>Session run over SSH without tmux (repeated unclean process terminations)</li>
</ul>
<h2>Related Issues</h2>
<ul>
<li>#8937 — Resume conversation doesn't display previous messages in terminal</li>
<li>#23800 — Chat history loss after PC restart, /resume recovers only 20-40% of context</li>
<li>#6689 — Feature request: --no-auto-compact command switch</li>
<li>#10691 — Feature request: configurable autoCompact settings</li>
</ul></body></html><!--EndFragment-->
</body>
</html>

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.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗