[Bug]: Claude "Auto-compact after" has no effect when CLAUDE_CODE_AUTO_COMPACT_WINDOW is set
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Set Settings → Providers → Claude → "Auto-compact after" to
400000. - Add
"CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000"to theenvblock of~/.claude/settings.json. - Start a Claude thread on a 1M-context model and keep working past 400k tokens.
Expected behavior
Claude compacts at the window set in "Auto-compact after", where the context meter draws its compaction tick (about 367,000 tokens).
Actual behavior
Claude ignores the T3 setting and uses the variable instead. The thread grew to 818k / 1m without compacting, while the meter kept its tick at about 367k, so compaction looks overdue or broken. Nothing shows that the setting has no effect.
T3 sends the setting as --settings {"autoCompactWindow":400000,...}, but Claude Code prefers CLAUDE_CODE_AUTO_COMPACT_WINDOW over autoCompactWindow. With the variable set, /autocompact 400k is refused with "CLAUDE_CODE_AUTO_COMPACT_WINDOW is set and takes precedence. Unset it to change this setting."
Impact
Minor bug or occasional failure
Version or commit
T3 Code desktop 0.1.9 (.deb); still in the code on main @ 587deab7d3
Environment
Ubuntu 26.04, Claude Code 2.1.322, Claude Opus 5.5 (1M window)
Notes
- First reported as a comment on #33798. #33806 fixed that issue's case (setting empty, variable set). When the T3 setting is filled,
resolveAutoCompactWindowstill returns it without checking the variable, and the launch never overrides the variable. - Claude Code applies
envfrom--settingsabove the settings files, so T3 can make its setting take effect by also sending it asCLAUDE_CODE_AUTO_COMPACT_WINDOWin thatenv, as it already does forENABLE_TOOL_SEARCH. Checked with Claude Code 2.1.323: with the variable at1000000in a project.claude/settings.json, adding--settings '{"env":{"CLAUDE_CODE_AUTO_COMPACT_WINDOW":"400000"}}'makes/autocompactreport400k tokens (from CLAUDE_CODE_AUTO_COMPACT_WINDOW).
Workaround
Remove the variable from settings.json. New sessions then use the T3 setting.