From 8368a274a08579049c7c19bc7776ed9f11c05555 Mon Sep 17 00:00:00 2001 From: Dai Ha Date: Tue, 22 Sep 2026 10:46:31 +0700 Subject: [PATCH] fleetd #618: state the measured auto-compact precedence, not 'unverified' ClaudeCodeArguments.withAutoCompactWindow's javadoc and FleetConfig's warnConflictingAutoCompactWindows WARN text both used to say the precedence between --autocompact and CLAUDE_CODE_AUTO_COMPACT_WINDOW was not verified. fleetd #618 measured it: the env var wins, so the flag has no effect when both are set. Update both texts to say so, name #618, and warn that deleting the env var to resolve the conflict LOWERS the live window rather than fixing anything. No behaviour change; the WARN still fires on the same condition and stays a WARN (per #601). --- .../java/dev/ltms/fleet/config/FleetConfig.java | 8 +++++--- .../dev/ltms/fleet/launch/ClaudeCodeArguments.java | 14 ++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/fleetd/src/main/java/dev/ltms/fleet/config/FleetConfig.java b/fleetd/src/main/java/dev/ltms/fleet/config/FleetConfig.java index 94f4916..45b415a 100644 --- a/fleetd/src/main/java/dev/ltms/fleet/config/FleetConfig.java +++ b/fleetd/src/main/java/dev/ltms/fleet/config/FleetConfig.java @@ -2285,9 +2285,11 @@ public record FleetConfig( names.sort(String::compareTo); detail.sort(String::compareTo); log.warn("Claude Code profile(s) {} set disagreeing autoCompactWindow and env." - + "CLAUDE_CODE_AUTO_COMPACT_WINDOW — the daemon starts anyway. Fix by " - + "removing one key or setting equal values on each: {}. Which input Claude " - + "Code actually follows when they disagree is not verified here.", + + "CLAUDE_CODE_AUTO_COMPACT_WINDOW — the daemon starts anyway: {}. fleetd " + + "#618 measured that CLAUDE_CODE_AUTO_COMPACT_WINDOW wins, so " + + "autoCompactWindow is inert on these profiles. Set equal values on each " + + "to resolve this — do not just delete the env var, since that LOWERS the " + + "live window to autoCompactWindow's value rather than fixing anything.", names, String.join(", ", detail)); } diff --git a/fleetd/src/main/java/dev/ltms/fleet/launch/ClaudeCodeArguments.java b/fleetd/src/main/java/dev/ltms/fleet/launch/ClaudeCodeArguments.java index ce2e214..263c2e4 100644 --- a/fleetd/src/main/java/dev/ltms/fleet/launch/ClaudeCodeArguments.java +++ b/fleetd/src/main/java/dev/ltms/fleet/launch/ClaudeCodeArguments.java @@ -15,13 +15,15 @@ public final class ClaudeCodeArguments { * Append the configured Claude Code auto-compaction window when the profile opts in. * *

This flag and the environment variable {@code CLAUDE_CODE_AUTO_COMPACT_WINDOW} can - * disagree. Which one Claude Code actually follows when they do is NOT verified here — this - * javadoc used to claim the environment variable always wins, but nobody had measured that, and - * this host's own {@code fleetd.yaml} asserts the opposite in a comment. So this javadoc no - * longer picks a side. {@link FleetConfig#load(java.nio.file.Path)} only WARNS when a Claude - * Code profile sets both to different values (see {@code + * disagree, and fleetd #618 measured which one Claude Code actually follows: the environment + * variable wins, ahead of this {@code --autocompact} flag, ahead of the settings file, ahead of + * clientdata, the experiment, and the model default. So when a profile sets both, the flag this + * method appends has NO effect — Claude Code reads {@code CLAUDE_CODE_AUTO_COMPACT_WINDOW} + * first and never consults the flag. {@link FleetConfig#load(java.nio.file.Path)} only WARNS + * when a Claude Code profile sets both to different values (see {@code * FleetConfig.warnConflictingAutoCompactWindows}) — it does not stop the daemon from starting, - * and a launched session may end up honouring either window. + * and the launched session honours the env var, not this flag. Measured against Claude Code + * 2.1.278 (fleetd #618) — a later version could reorder this precedence. */ public static List withAutoCompactWindow(List argv, FleetConfig.Profile profile) { if (profile.autoCompactWindow() == null) {