Skip to content

Commit 16be546

Browse files
t3dotggclaude
andcommitted
feat(web,mobile): fast worktree checkout is an opt-in Labs beta
Move the switch from Worktrees > Advanced to Labs > Beta, off by default. Mobile Labs now lists each Mac with its own switch, like linked environments. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 3e6ca84 commit 16be546

7 files changed

Lines changed: 103 additions & 89 deletions

File tree

‎apps/mobile/src/features/settings/ThreadSettingsSections.tsx‎

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { AutoSettleDaysField } from "./components/AutoSettleDaysField";
99
import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
1010
import { useAtomSet, useAtomValue } from "@effect/atom-react";
1111
import { AsyncResult } from "effect/reactivity";
12+
import type { ComponentProps } from "react";
1213
import { View } from "react-native";
1314
import { useSafeAreaInsets } from "react-native-safe-area-context";
1415

@@ -45,7 +46,20 @@ export function SettingsLabsRouteScreen() {
4546
contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}
4647
>
4748
<ToolCallVisibilitySection />
48-
<BetaSettingsSection />
49+
<MachineBetaSection
50+
title="Linked environments"
51+
icon="link"
52+
capability="peerLinks"
53+
setting="linkedEnvironmentsEnabled"
54+
description="Let agents on a machine work on your other machines, and theirs on it. Turn it on for each machine. While off, nothing new starts over a link; running tasks finish."
55+
/>
56+
<MachineBetaSection
57+
title="Fast worktree checkout"
58+
icon="bolt.circle"
59+
capability="fastWorktreeCheckout"
60+
setting="fastWorktreeCheckout"
61+
description="On a Mac, clone new worktrees from a checkout cached in the T3 home folder instead of writing every file. Uses Git’s normal checkout when it can’t. Turning it off deletes the cache."
62+
/>
4963
<LegacySettingsSection />
5064
</ScrollView>
5165
</SettingsScreen>
@@ -228,48 +242,64 @@ export function NewThreadSettingsSection() {
228242
);
229243
}
230244

231-
/** Per machine, since each machine's own setting decides whether it links and answers links. */
232-
function BetaSettingsSection() {
245+
type MachineBetaSetting = "linkedEnvironmentsEnabled" | "fastWorktreeCheckout";
246+
247+
/** One switch per connected machine that offers the beta, since each machine's own setting decides. */
248+
function MachineBetaSection({
249+
title,
250+
icon,
251+
capability,
252+
setting,
253+
description,
254+
}: {
255+
readonly title: string;
256+
readonly icon: ComponentProps<typeof SettingsSwitchRow>["icon"];
257+
readonly capability: "peerLinks" | "fastWorktreeCheckout";
258+
readonly setting: MachineBetaSetting;
259+
readonly description: string;
260+
}) {
233261
const { environments } = useEnvironments();
234262
const supported = environments.filter(
235263
(environment) =>
236264
environment.connection.phase === "connected" &&
237-
environment.serverConfig?.environment.capabilities.peerLinks === true,
265+
environment.serverConfig?.environment.capabilities[capability] === true,
238266
);
239267
const writable = useEnvironmentsWithScope(supported, AuthSettingsWriteScope);
240268
const updateSettings = useAtomCommand(serverEnvironment.updateSettings, {
241-
label: "linked environments beta update",
269+
label: `${setting} beta update`,
242270
reportFailure: true,
243271
});
244272
if (supported.length === 0) return null;
245273
return (
246274
<View className="gap-3">
247-
<SettingsSection title="Beta: Linked environments">
275+
<SettingsSection title={`Beta: ${title}`}>
248276
{supported.map((environment) => {
249277
const policy = environment.serverConfig?.managedPolicy;
250-
const managed = isManagedSettingPath(policy, "linkedEnvironmentsEnabled");
278+
const managed = isManagedSettingPath(policy, setting);
251279
return (
252280
<SettingsSwitchRow
253281
key={environment.environmentId}
254-
icon="link"
282+
icon={icon}
255283
label={environment.label}
256284
{...(managed ? { subtitle: `Managed by ${policy?.organization}.` } : {})}
257-
value={environment.serverConfig?.settings.linkedEnvironmentsEnabled === true}
285+
value={environment.serverConfig?.settings[setting] === true}
258286
disabled={managed || !writable.has(environment.environmentId)}
259287
onValueChange={(value) =>
260288
void updateSettings({
261289
environmentId: environment.environmentId,
262-
input: { patch: { linkedEnvironmentsEnabled: value } },
290+
input: {
291+
patch:
292+
setting === "linkedEnvironmentsEnabled"
293+
? { linkedEnvironmentsEnabled: value }
294+
: { fastWorktreeCheckout: value },
295+
},
263296
})
264297
}
265298
/>
266299
);
267300
})}
268301
</SettingsSection>
269-
<Text className="px-2 text-sm text-foreground-muted">
270-
Let agents on a machine work on your other machines, and theirs on it. Turn it on for each
271-
machine. While off, nothing new starts over a link; running tasks finish.
272-
</Text>
302+
<Text className="px-2 text-sm text-foreground-muted">{description}</Text>
273303
</View>
274304
);
275305
}

‎apps/mobile/src/features/settings/settings-search.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ const SETTINGS_SEARCH_TERMS = {
104104
"beta",
105105
"linked environments",
106106
"link machine",
107+
"fast worktree checkout",
108+
"clone cache",
107109
"tool calls in chat",
108110
"hide tool calls",
109111
"commands edits searches",

‎apps/web/src/components/settings/LabsSettingsPanel.tsx‎

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { SettingsPageContainer, SettingsRow, SettingsSection } from "./settingsL
1414
import { searchableSetting } from "./settingsSearch";
1515
import { LegacyFeaturesSection } from "./SettingsPanels";
1616
import { useScopedSettings, useUpdateScopedSettings } from "./useScopedSettings";
17-
import { useOptionalSettingsScope } from "./SettingsScopeContext";
17+
import { useOptionalSettingsScope, useSettingsScope } from "./SettingsScopeContext";
1818
import { firstManagedDenial, usePrimaryManagedPolicy } from "~/state/managedPolicy";
1919

2020
/** Features still settling in, and legacy behavior kept for people who rely on it. */
@@ -29,6 +29,7 @@ export function LabsSettingsPanel() {
2929
{hasCloudPublicConfig() ? <GuestLinksRowWithSignIn /> : <GuestLinksRow />}
3030
<LinkedEnvironmentsRow />
3131
<SimlockHostsRow />
32+
<FastWorktreeCheckoutRow />
3233
</SettingsSection>
3334
<LegacyFeaturesSection />
3435
</SettingsPageContainer>
@@ -247,3 +248,36 @@ function SimlockHostsRow() {
247248
/>
248249
);
249250
}
251+
252+
/** Shows only when every machine in scope is a Mac, since only macOS servers honor it. */
253+
function FastWorktreeCheckoutRow() {
254+
const { scope, connectedEnvironments } = useSettingsScope();
255+
const settings = useScopedSettings();
256+
const updateSettings = useUpdateScopedSettings();
257+
if (
258+
scope.kind === "project" ||
259+
scope.kind === "checkout" ||
260+
connectedEnvironments.length === 0 ||
261+
connectedEnvironments.some(
262+
(environment) =>
263+
environment.serverConfig?.environment.capabilities.fastWorktreeCheckout !== true,
264+
)
265+
)
266+
return null;
267+
return (
268+
<SettingsRow
269+
serverScoped
270+
{...searchableSetting("worktree-fast-checkout")}
271+
settingKeys={["fastWorktreeCheckout"]}
272+
description="On a Mac, clone new worktrees from a checkout cached in the T3 home folder instead of writing every file. Uses Git’s normal checkout when it can’t. Turning it off deletes the cache."
273+
control={
274+
<ScopedSwitch
275+
settingKeys={["fastWorktreeCheckout"]}
276+
checked={settings.fastWorktreeCheckout}
277+
onCheckedChange={(checked) => updateSettings({ fastWorktreeCheckout: Boolean(checked) })}
278+
aria-label="Fast worktree checkout"
279+
/>
280+
}
281+
/>
282+
);
283+
}

‎apps/web/src/components/settings/WorktreesSettings.tsx‎

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ import {
1313
} from "./settingsLayout";
1414
import { searchableSetting } from "./settingsSearch";
1515
import { WorktreeCleanupSection, WorktreesDirectoryRow } from "./StorageSettings";
16-
import {
17-
useScopedSettings,
18-
useScopedSettingsMixed,
19-
useUpdateScopedSettings,
20-
} from "./useScopedSettings";
16+
import { useScopedSettings, useUpdateScopedSettings } from "./useScopedSettings";
2117

2218
function StartFromRemoteRow() {
2319
const settings = useScopedSettings();
@@ -55,49 +51,6 @@ function StartFromRemoteRow() {
5551
);
5652
}
5753

58-
function FastCheckoutRow() {
59-
const { connectedEnvironments } = useSettingsScope();
60-
const settings = useScopedSettings();
61-
const updateSettings = useUpdateScopedSettings();
62-
const mixed = useScopedSettingsMixed(["fastWorktreeCheckout"]);
63-
if (
64-
connectedEnvironments.length === 0 ||
65-
connectedEnvironments.some(
66-
(environment) =>
67-
environment.serverConfig?.environment.capabilities.fastWorktreeCheckout !== true,
68-
)
69-
)
70-
return null;
71-
return (
72-
<SettingsRow
73-
serverScoped
74-
settingKeys={["fastWorktreeCheckout"]}
75-
{...searchableSetting("worktree-fast-checkout")}
76-
description="Clones new worktrees from a checkout cached in the T3 home folder instead of writing every file. Uses Git’s normal checkout when it can’t."
77-
resetAction={
78-
mixed || settings.fastWorktreeCheckout !== DEFAULT_UNIFIED_SETTINGS.fastWorktreeCheckout ? (
79-
<SettingResetButton
80-
label="fast checkout"
81-
onClick={() =>
82-
updateSettings({
83-
fastWorktreeCheckout: DEFAULT_UNIFIED_SETTINGS.fastWorktreeCheckout,
84-
})
85-
}
86-
/>
87-
) : null
88-
}
89-
control={
90-
<ScopedSwitch
91-
settingKeys={["fastWorktreeCheckout"]}
92-
checked={settings.fastWorktreeCheckout}
93-
onCheckedChange={(checked) => updateSettings({ fastWorktreeCheckout: Boolean(checked) })}
94-
aria-label="Clone new worktrees from a cached checkout"
95-
/>
96-
}
97-
/>
98-
);
99-
}
100-
10154
export function WorktreesSettingsPanel() {
10255
const { scope } = useSettingsScope();
10356
const isProjectScope = scope.kind === "project" || scope.kind === "checkout";
@@ -107,14 +60,8 @@ export function WorktreesSettingsPanel() {
10760
<SettingsSection id="worktree-creation" title="Creation">
10861
{!isProjectScope && <WorktreesDirectoryRow />}
10962
<StartFromRemoteRow />
110-
<AdvancedSettings
111-
targetIds={[
112-
searchableSetting("worktree-submodules").id,
113-
searchableSetting("worktree-fast-checkout").id,
114-
]}
115-
>
63+
<AdvancedSettings targetIds={[searchableSetting("worktree-submodules").id]}>
11664
<WorktreeSubmodulesRow />
117-
{!isProjectScope && <FastCheckoutRow />}
11865
</AdvancedSettings>
11966
</SettingsSection>
12067
<SettingsSection id="worktree-branches" title="Branches">

‎apps/web/src/components/settings/settingsSearch.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,6 @@ export const SETTINGS_SEARCH_ITEMS = [
252252
scope: "environment-defaults",
253253
searchTerms: ["worktree location folder directory path drive external disk"],
254254
},
255-
{
256-
id: "worktree-fast-checkout",
257-
title: "Fast checkout",
258-
to: "/settings/worktrees",
259-
scope: "environment-defaults",
260-
fastWorktreeCheckoutOnly: true,
261-
searchTerms: ["fast worktree checkout clone apfs copy-on-write cache macos speed"],
262-
},
263255
{
264256
id: "storage-artifacts",
265257
title: "Artifacts and logs",
@@ -505,6 +497,14 @@ export const SETTINGS_SEARCH_ITEMS = [
505497
scope: "environment",
506498
searchTerms: ["beta alpha simlock callstack simulator emulator ios android pool lease gateway"],
507499
},
500+
{
501+
id: "worktree-fast-checkout",
502+
title: "Fast worktree checkout",
503+
to: "/settings/labs",
504+
scope: "environment",
505+
fastWorktreeCheckoutOnly: true,
506+
searchTerms: ["beta fast worktree checkout clone apfs copy-on-write cache macos speed"],
507+
},
508508
{
509509
id: "voice-transcription-destination",
510510
title: "Transcribe with",

‎docs/user/project-settings.md‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,16 @@ are, and cleanup covers both the default folder and the custom one.
203203

204204
## Fast worktree checkout on macOS
205205

206-
On a Mac, T3 Code keeps a few recent checkouts of each repository in the `caches` folder of the T3
207-
home directory. A new worktree is cloned from one of them with APFS copy-on-write, which is about
208-
twice as fast as writing every file and makes the first `git status` in it fast as well. The first
209-
worktree of a repository uses Git's normal checkout and fills the cache. It needs Git 2.42 or newer.
210-
Git's normal checkout is also used for worktrees on a different drive from the T3 home directory,
211-
sparse checkouts, repositories whose attributes use filters such as Git LFS, and repositories
212-
whose checkout settings changed.
213-
Turn it off in **Settings → Worktrees → Fast checkout** under Advanced, which also deletes the
214-
cache.
206+
Fast worktree checkout is a beta. Turn it on for each Mac in **Settings → Labs → Fast worktree
207+
checkout**. T3 Code then keeps a few recent checkouts of each repository in the `caches` folder of
208+
the T3 home directory. A new worktree is cloned from one of them with APFS copy-on-write, which is
209+
about twice as fast as writing every file and makes the first `git status` in it fast as well.
210+
Turning it off deletes the cache.
211+
212+
The first worktree of a repository uses Git's normal checkout and fills the cache. It needs Git 2.42
213+
or newer. Git's normal checkout is also used for worktrees on a different drive from the T3 home
214+
directory, sparse checkouts, repositories whose attributes use filters such as Git LFS, and
215+
repositories whose checkout settings changed.
215216

216217
## Storage cleanup
217218

‎packages/contracts/src/settings.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,8 +1259,8 @@ export const ServerSettings = Schema.Struct({
12591259
),
12601260

12611261
worktreesDirectory: TrimmedString.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
1262-
/** macOS only: clone new worktrees from a cached checkout instead of writing every file. */
1263-
fastWorktreeCheckout: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
1262+
/** macOS only, Labs beta: clone new worktrees from a cached checkout instead of writing every file. */
1263+
fastWorktreeCheckout: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
12641264
/** Server-maintained history keeps old worktrees eligible for cleanup and review diffs. */
12651265
previousWorktreesDirectories: Schema.Array(TrimmedString).pipe(
12661266
Schema.withDecodingDefault(Effect.succeed([])),

0 commit comments

Comments
 (0)