Skip to content

Commit 5063403

Browse files
refactor(server): read the Auto-compact after setting once
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent b7ca410 commit 5063403

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,12 +2009,16 @@ export function makeClaudeQueryOptions(input: {
20092009
: typeof input.sdkSettings === "object" && input.sdkSettings !== null
20102010
? ({ ...input.sdkSettings, ...selectionSettings } as ClaudeSdkSettings)
20112011
: selectionSettings;
2012-
const compactQuerySettings =
2012+
const autoCompactWindow =
20132013
input.settings?.autoCompactWindow === undefined || input.settings.autoCompactWindow.length === 0
2014+
? undefined
2015+
: input.settings.autoCompactWindow;
2016+
const compactQuerySettings =
2017+
autoCompactWindow === undefined
20142018
? querySettings
20152019
: ({
20162020
...(typeof querySettings === "object" && querySettings !== null ? querySettings : {}),
2017-
autoCompactWindow: Number(input.settings.autoCompactWindow),
2021+
autoCompactWindow: Number(autoCompactWindow),
20182022
} as ClaudeSdkSettings);
20192023
// Claude Code expands a bare alias to its own model, so a custom model with an alias's name
20202024
// pins the alias to itself.
@@ -2027,9 +2031,9 @@ export function makeClaudeQueryOptions(input: {
20272031
// Claude Code prefers CLAUDE_CODE_AUTO_COMPACT_WINDOW from any settings env over
20282032
// autoCompactWindow, and flag settings env beats the settings files.
20292033
const autoCompactEnv =
2030-
input.settings?.autoCompactWindow === undefined || input.settings.autoCompactWindow.length === 0
2034+
autoCompactWindow === undefined
20312035
? undefined
2032-
: { CLAUDE_CODE_AUTO_COMPACT_WINDOW: input.settings.autoCompactWindow };
2036+
: { CLAUDE_CODE_AUTO_COMPACT_WINDOW: autoCompactWindow };
20332037
// A settings file path cannot take extra keys, so it goes through unchanged.
20342038
const effectiveQuerySettings =
20352039
(input.toolSearchOverride === undefined &&

0 commit comments

Comments
 (0)