Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/server/src/serverSettings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,11 @@ it.layer(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))("server settings"
}).pipe(Effect.provide(layerServerSettings())),
);

it.effect("tells clients it reads idle compaction modes before any settings are saved", () =>
it.effect("defaults to never compacting idle threads, and says so in the mode field", () =>
Effect.gen(function* () {
const service = yield* ServerSettingsModule.ServerSettingsService;
const settings = yield* service.getSettings;
assert.equal(settings.idleCompaction, "onReturn");
assert.equal(settings.idleCompaction, "off");
assert.strictEqual(settings.compactIdleThreads, false);
}).pipe(Effect.provide(layerServerSettings())),
);
Expand Down
20 changes: 16 additions & 4 deletions apps/server/src/serverSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ const make = Effect.gen(function* () {
let legacyProviders: Readonly<Record<string, unknown>> | undefined;
let legacySourceControl: Parameters<typeof migrateLegacySourceControlSettings>[1] = {};
let parseFailure = Option.none<unknown>();
// Whether the file records an idle compaction choice, in either field.
let savedIdleCompaction = false;

if (yield* readConfigExists) {
const raw = yield* readRawConfig;
Expand Down Expand Up @@ -817,12 +819,22 @@ const make = Effect.gen(function* () {
}
} else {
settings = decoded.value;
const file: unknown = parsed._tag === "Success" ? parsed.value : undefined;
savedIdleCompaction =
typeof file === "object" &&
file !== null &&
("idleCompaction" in file || "compactIdleThreads" in file);
}
}
// Settings saved by a server that kept the mode in `compactIdleThreads` move
// it to `idleCompaction`, so that switch goes to clients as a boolean. The
// defaults gain the field too, which tells clients this server reads modes.
settings = withIdleCompaction(settings, globalIdleCompaction(settings));
// Move a legacy `compactIdleThreads` mode to `idleCompaction` (clients read the
// switch as a boolean). The field's presence tells clients this server reads modes.
// Without a saved or policy choice, never compact idle threads.
settings = withIdleCompaction(
settings,
savedIdleCompaction || settings.idleCompaction !== undefined
? globalIdleCompaction(settings)
: "off",
);

// A file that failed to decode must stay on disk for the user to repair.
const settingsFileTrusted = Option.isNone(parseFailure);
Expand Down
5 changes: 3 additions & 2 deletions docs/user/providers-claude.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ composer commands.
**Compact idle threads** in **Settings > Providers > Advanced** controls this for threads
over 200,000 tokens. Each Claude provider's settings can override it:

- **When you return** shows the **Compact** chip described above. This is the default.
- **When you return** shows the **Compact** chip described above.
- **Before the cache expires (beta)** tries to compact an idle thread shortly before its
prompt cache expires, while the history is still cached.
The compaction appears in the thread as a `/compact` turn sent by T3 Code.
If the window is missed, such as when you enable this mode after the cache has
expired or the server restarts before compaction runs, it falls back to
**When you return**. Switch the chip to **Keep** to keep the full history for that message.
- **Never** skips idle compaction and Claude's resume prompt. **Auto-compact after**
still applies, and you can still compact by hand.
still applies, and you can still compact by hand. This is the default: how long you
were away says nothing about whether the conversation needs summarizing.

## Usage limits

Expand Down
Loading