Skip to content

[Bug]: Claude "Auto-compact after" has no effect when CLAUDE_CODE_AUTO_COMPACT_WINDOW is set #35725

Closed

Description

@sungyongcho

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Set Settings → Providers → Claude → "Auto-compact after" to 400000.
  2. Add "CLAUDE_CODE_AUTO_COMPACT_WINDOW": "1000000" to the env block of ~/.claude/settings.json.
  3. 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 @ 587deab

Environment

Ubuntu 26.04, Claude Code 2.1.322, Claude Opus 5.5 (1M window)

Notes

  • First reported as a comment on #33798. fix(server): Claude context meter honours CLAUDE_CODE_AUTO_COMPACT_WINDOW #33806 fixed that issue's case (setting empty, variable set). When the T3 setting is filled, resolveAutoCompactWindow still returns it without checking the variable, and the launch never overrides the variable.
  • Claude Code applies env from --settings above the settings files, so T3 can make its setting take effect by also sending it as CLAUDE_CODE_AUTO_COMPACT_WINDOW in that env, as it already does for ENABLE_TOOL_SEARCH. Checked with Claude Code 2.1.323: with the variable at 1000000 in a project .claude/settings.json, adding --settings '{"env":{"CLAUDE_CODE_AUTO_COMPACT_WINDOW":"400000"}}' makes /autocompact report 400k tokens (from CLAUDE_CODE_AUTO_COMPACT_WINDOW).

Workaround

Remove the variable from settings.json. New sessions then use the T3 setting.

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