GrowthBook experiment tengu_amber_redwood silently reduces autocompact window to ~80k on Sonnet 200k (v2.1.92+ regression)
Summary
GrowthBook experiment tengu_amber_redwood silently reduces the autocompact window on Sonnet 4.6 (200k context) to an effective ~80k tokens, causing compaction at ~23-25% context usage. This is the same class of bug as #43989 (Opus 1M → 400k) but affecting standard 200k context models — a much wider user base.
The built-in notification jz7() that should warn users about experiment-driven compaction ("compacted at {X} · override with CLAUDE_CODE_AUTO_COMPACT_WINDOW=...") does not appear to fire or render visibly.
Evidence
Measured compaction events from JSONL session transcripts (v2.1.100)
| Session | Model | preTokens | % of native window | Expected threshold |
|---------|-------|-------------|---------------------|--------------------|
| bb7608fc | sonnet-4-6 | 48,275 | 24.1% of 200k | 167k |
| bb7608fc | sonnet-4-6 | 45,281 | 22.6% of 200k | 167k |
| bb7608fc | sonnet-4-6 | 46,771 | 23.4% of 200k | 167k |
| 02395a86 | sonnet-4-6 | 50,206 | 25.1% of 200k | 167k |
| 904ab744 | opus-4-6 | 75,414 | 7.5% of 1M | 967k |
| 904ab744 | opus-4-6 | 47,353 | 4.7% of 1M | 967k |
| 904ab744 | opus-4-6 | 50,231 | 5.0% of 1M | 967k |
Cluster: 6/7 events trigger at 45,281–50,231 tokens (mean: 47,886). All well below the expected threshold.
Reverse-engineering the experiment value
From the source code (deobfuscated from v2.1.100 binary):
autoCompactThreshold = contextWindow - maxOutputTokens(20k) - buffer(13k)
If threshold ≈ 47k → effectiveWindow ≈ 60k → experiment is setting window ≈ 80k.
For Sonnet 200k: 80k is a 60% reduction of the native context window.
For Opus 1M: the 400k reported in #43989 is also a 60% reduction — consistent ratio.
Window resolution priority (from binary)
function vt(model, settingsWindow) {
let nativeWindow = getModelWindow(model);
// 1. env var CLAUDE_CODE_AUTO_COMPACT_WINDOW → highest priority
// 2. user settings (autoCompactWindow)
// 3. GrowthBook "tengu_amber_redwood" ← the problem
// 4. model native window ← never reached when enrolled
}
Notification that should fire but doesn't
function jz7(app, model, window) {
let {source, configured} = vt(model, window);
if (source !== "experiment") return;
app.addNotification?.({
key: "autocompact-experiment-hint",
text: `compacted at ${configured} · override with CLAUDE_CODE_AUTO_COMPACT_WINDOW=1000000`,
priority: "medium"
});
}
This notification exists specifically for experiment-enrolled users but either doesn't render or is dismissed before it can be seen.
Steps to Reproduce
- Install Claude Code v2.1.100 on macOS arm64
- Use model
sonnet-4-6(standard 200k context, NOT the 1M variant) - Have a conversation with 3-5 turns involving tool use (file reads, bash commands)
- Observe compaction triggers at ~45-50k tokens (~23% of 200k)
- Check JSONL transcript:
compact_boundaryevents showpreTokens≈ 47-50k
Expected Behavior
Sonnet 4.6 with 200k context should compact at:
200k - 20k(output) - 13k(buffer) = 167k tokens(~83.5% usage)
Actual Behavior
Compaction triggers at ~47-50k tokens (23-25% usage), wasting 75% of the context window.
Sessions become unusable: after compaction reduces to ~20-30k tokens, only 2-4 tool-use turns fit before the next compaction — creating a thrashing loop. In one session, 3 compactions occurred within 6 minutes.
Additional issues
CLAUDE_AUTOCOMPACT_PCT_OVERRIDEcannot raise the threshold — the code usesMath.min(userPct, defaultThreshold), silently ignoring any value above default (#31806)DISABLE_AUTO_COMPACT=1does not affect microcompacts — three additional silent compaction mechanisms (time-based microcompact, cached microcompact, tool-result budget viatengu_hawthorn_window) run independently- No opt-out for experiments — users cannot inspect or disable GrowthBook flags without reverse-engineering the binary. The experiment silently overrides model capabilities that users are paying for.
Workaround
Add to ~/.claude/settings.json:
{
"env": {
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000"
}
}
This takes priority position 1 in vt(), overriding the experiment. Note: reportedly does not work on all arm64 native builds (#43989 comment by @creatornader).
Environment
- Claude Code version: 2.1.100
- Model: claude-sonnet-4-6 (200k) and claude-opus-4-6 (opusplan mode)
- Platform: macOS Darwin 25.4.0 (Apple Silicon arm64)
- Terminal: iTerm2 / zsh
- Regression since: v2.1.92 (confirmed by #43989)
Related issues
- #43989 — same experiment, Opus 1M → 400k
- #42375 — same class of bug, Opus 1M at 6%
- #42817 — consolidated report: multiple disable methods silently ignored
- #31806 —
CLAUDE_AUTOCOMPACT_PCT_OVERRIDEcapped byMath.min - #45977 —
DISABLE_AUTO_COMPACT=1bypassed on session resume - #42542 — silent microcompacts not affected by any user override
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗