Skip to content

Commit 61423c5

Browse files
committed
fix(connections): make auto balance opt-in
1 parent 4cfe8bf commit 61423c5

3 files changed

Lines changed: 19 additions & 3 deletions

File tree

‎docs/user/remote-access.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ another link to share.
6363

6464
### Balance new threads across machines
6565

66-
On web and desktop, **Settings → Connections → Load balancing** enables automatic
67-
machine selection for new threads in projects grouped across connected environments.
66+
Auto balance is off by default. On web and desktop, enable it in
67+
**Settings → Connections → Load balancing** to automatically choose a machine for
68+
new threads in projects grouped across connected environments.
6869
Each machine starts at **Normal**. Choose **Prefer** to favor it when it has CPU and
6970
memory available, **Less often** to reduce its share, or **Manual only** to exclude
7071
it from automatic selection. These are preferences, not fixed traffic percentages.

‎packages/contracts/src/settings.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,21 @@ describe("ClaudeSettings auto-compaction", () => {
135135
});
136136
});
137137

138+
describe("ClientSettings load balancing", () => {
139+
it("requires opt-in when settings are new or omit load balancing", () => {
140+
expect(decodeClientSettings({}).loadBalancingEnabled).toBe(false);
141+
expect(decodeClientSettings({ loadBalancingWeights: {} }).loadBalancingEnabled).toBe(false);
142+
});
143+
144+
it.each([true, false])("preserves a saved choice of %s", (loadBalancingEnabled) => {
145+
const settings = decodeClientSettings({ loadBalancingEnabled });
146+
expect(encodeClientSettings(settings).loadBalancingEnabled).toBe(loadBalancingEnabled);
147+
expect(decodeClientSettingsPatch({ loadBalancingEnabled }).loadBalancingEnabled).toBe(
148+
loadBalancingEnabled,
149+
);
150+
});
151+
});
152+
138153
describe("ClientSettings word wrap", () => {
139154
it("defaults word wrap on", () => {
140155
expect(decodeClientSettings({}).wordWrap).toBe(true);

‎packages/contracts/src/settings.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export const LoadBalancingWeights = Schema.Record(
205205
);
206206

207207
export const ClientSettingsSchema = Schema.Struct({
208-
loadBalancingEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
208+
loadBalancingEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
209209
loadBalancingWeights: LoadBalancingWeights.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
210210
appearanceContrast: AppearanceContrast.pipe(
211211
Schema.withDecodingDefault(Effect.succeed(DEFAULT_APPEARANCE_CONTRAST)),

0 commit comments

Comments
 (0)