Skip to content
TypeScript

fix: restore automatic thread settling defaults (#8596)

Theo Browne38154388d7b0
diff --git a/apps/desktop/src/settings/DesktopClientSettings.test.ts b/apps/desktop/src/settings/DesktopClientSettings.test.ts
index 1d5fd02b0c9..e32a5e2d080 100644
--- a/apps/desktop/src/settings/DesktopClientSettings.test.ts
+++ b/apps/desktop/src/settings/DesktopClientSettings.test.ts
@@ -40,7 +40,7 @@ const clientSettings: ClientSettings = {
showSkillsInSlashMenu: false,
providerModelPreferences: {},
sidebarAutoSettleAfterDays: 3,
- sidebarAutoSettleMode: "change-request",
+ sidebarAutoSettleOnMerge: true,
sidebarProjectGroupingMode: "repository_path",
sidebarProjectGroupingOverrides: {
"environment-1:/tmp/project-a": "separate",
diff --git a/apps/mobile/src/Stack.tsx b/apps/mobile/src/Stack.tsx
index ccbda8998fa..7cffbf62b0d 100644
--- a/apps/mobile/src/Stack.tsx
+++ b/apps/mobile/src/Stack.tsx
@@ -51,7 +51,6 @@ import {
import { NewTaskFlowProvider } from "./features/threads/new-task-flow-provider";
import { NewTaskRouteScreen } from "./features/threads/NewTaskRouteScreen";
import { SettingsAppearanceRouteScreen } from "./features/settings/SettingsAppearanceRouteScreen";
-import { SettingsAutoSettleRouteScreen } from "./features/settings/SettingsAutoSettleRouteScreen";
import { SettingsClientStorageRouteScreen } from "./features/settings/SettingsClientStorageRouteScreen";
import { SettingsAuthRouteScreen } from "./features/settings/SettingsAuthRouteScreen";
import { SettingsEnvironmentsRouteScreen } from "./features/settings/SettingsEnvironmentsRouteScreen";
@@ -178,13 +177,6 @@ const SettingsContentStack = createNativeStackNavigator({
title: "Appearance",
},
}),
- SettingsAutoSettle: createNativeStackScreen({
- screen: SettingsAutoSettleRouteScreen,
- linking: "thread-settling",
- options: {
- title: "Thread Settling",
- },
- }),
SettingsProjectGrouping: createNativeStackScreen({
screen: SettingsProjectGroupingRouteScreen,
linking: "project-grouping",
diff --git a/apps/mobile/src/features/home/HomeScreen.tsx b/apps/mobile/src/features/home/HomeScreen.tsx
index 3f7bba4c059..57cbb9125e9 100644
--- a/apps/mobile/src/features/home/HomeScreen.tsx
+++ b/apps/mobile/src/features/home/HomeScreen.tsx
@@ -30,7 +30,6 @@ import type { WorkspaceEnvironment, WorkspaceState } from "../../state/workspace
import type { SavedRemoteConnection } from "../../lib/connection";
import { scopedProjectKey } from "../../lib/scopedEntities";
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
-import { resolveMobileAutoSettlePreferences } from "../../persistence/mobile-preferences";
import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
import { useThreadSearch } from "../../state/queries";
import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled";
@@ -209,9 +208,9 @@ export function HomeScreen(props: HomeScreenProps) {
>(() => new Map());
const preferencesResult = useAtomValue(mobilePreferencesAtom);
const threadListV2Enabled = useThreadListV2Enabled();
- const autoSettlePreferences = resolveMobileAutoSettlePreferences(
- AsyncResult.isSuccess(preferencesResult) ? preferencesResult.value : {},
- );
+ const autoSettleOnMerge =
+ !AsyncResult.isSuccess(preferencesResult) ||
+ preferencesResult.value.autoSettleOnMerge !== false;
const savePreferences = useAtomSet(updateMobilePreferencesAtom);
const openSwipeableRef = useRef<SwipeableMethods | null>(null);
const listRef = useRef<LegendListRef | null>(null);
@@ -679,8 +678,7 @@ export function HomeScreen(props: HomeScreenProps) {
searchQuery: props.searchQuery,
matchedThreadKeys,
changeRequestByKey,
- autoSettleAfterDays: autoSettlePreferences.autoSettleAfterDays,
- autoSettleMode: autoSettlePreferences.autoSettleMode,
+ autoSettleOnMerge,
settlementEnvironmentIds,
snoozeEnvironmentIds,
settledLimit: settledVisibleCount,
@@ -692,8 +690,7 @@ export function HomeScreen(props: HomeScreenProps) {
});
}, [
changeRequestByKey,
- autoSettlePreferences.autoSettleAfterDays,
- autoSettlePreferences.autoSettleMode,
+ autoSettleOnMerge,
nowMinute,
snoozeWakeTick,
snoozedShelfExpanded,
diff --git a/apps/mobile/src/features/settings/SettingsAutoSettleRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsAutoSettleRouteScreen.tsx
deleted file mode 100644
index 690ca01e682..00000000000
--- a/apps/mobile/src/features/settings/SettingsAutoSettleRouteScreen.tsx
+++ /dev/null
@@ -1,173 +0,0 @@
-import { useAtomSet, useAtomValue } from "@effect/atom-react";
-import { useNavigation } from "@react-navigation/native";
-import {
- MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
- MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
- type SidebarAutoSettleMode,
-} from "@t3tools/contracts";
-import { AsyncResult } from "effect/unstable/reactivity";
-import { Platform, Pressable, ScrollView, View } from "react-native";
-import { useSafeAreaInsets } from "react-native-safe-area-context";
-
-import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
-import { AppText as Text } from "../../components/AppText";
-import { SymbolView } from "../../components/AppSymbol";
-import { useUniwindTheme } from "../../lib/useUniwindTheme";
-import { NativeStackScreenOptions } from "../../native/StackHeader";
-import { resolveMobileAutoSettlePreferences } from "../../persistence/mobile-preferences";
-import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
-import { SettingsSection } from "./components/SettingsSection";
-
-const AUTO_SETTLE_OPTIONS: ReadonlyArray<{
- readonly mode: SidebarAutoSettleMode;
- readonly label: string;
- readonly description: string;
-}> = [
- {
- mode: "never",
- label: "Never",
- description: "Threads settle only when you choose Settle.",
- },
- {
- mode: "change-request",
- label: "When a pull request merges or closes",
- description: "A missing or uncertain pull-request timestamp keeps the thread active.",
- },
- {
- mode: "inactivity",
- label: "After inactivity",
- description: "Running, blocked, and open-pull-request threads stay active.",
- },
-];
-
-export function mobileAutoSettleModeLabel(mode: SidebarAutoSettleMode): string {
- if (mode === "change-request") return "PR merged or closed";
- if (mode === "inactivity") return "After inactivity";
- return "Never";
-}
-
-export function SettingsAutoSettleRouteScreen() {
- const navigation = useNavigation();
- const insets = useSafeAreaInsets();
- const checkmarkColor = useUniwindTheme()["--color-icon"];
- const preferencesResult = useAtomValue(mobilePreferencesAtom);
- const savePreferences = useAtomSet(updateMobilePreferencesAtom);
- const preferencesReady = AsyncResult.isSuccess(preferencesResult) && !preferencesResult.waiting;
- const resolved = resolveMobileAutoSettlePreferences(
- AsyncResult.isSuccess(preferencesResult) ? preferencesResult.value : {},
- );
-
- const setDays = (days: number) => {
- if (!preferencesReady) return;
- savePreferences({
- autoSettleAfterDays: Math.min(
- MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
- Math.max(MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS, days),
- ),
- });
- };
-
- return (
- <View collapsable={false} className="flex-1 bg-sheet">
- {Platform.OS === "android" ? (
- <>
- <NativeStackScreenOptions options={{ headerShown: false }} />
- <AndroidScreenHeader title="Thread Settling" onBack={() => navigation.goBack()} />
- </>
- ) : null}
- <ScrollView
- contentInsetAdjustmentBehavior="automatic"
- showsVerticalScrollIndicator={false}
- className="flex-1"
- contentContainerClassName="gap-4 px-5 pt-4"
- contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}
- >
- <SettingsSection title="Automatic settling">
- {AUTO_SETTLE_OPTIONS.map((option, index) => (
- <Pressable
- key={option.mode}
- accessibilityRole="radio"
- accessibilityState={{
- checked: resolved.autoSettleMode === option.mode,
- disabled: !preferencesReady,
- }}
- disabled={!preferencesReady}
- onPress={() => savePreferences({ autoSettleMode: option.mode })}
- className={
- index === 0
- ? "flex-row items-center gap-4 p-4"
- : "flex-row items-center gap-4 border-t border-border-subtle p-4"
- }
- >
- <View className="min-w-0 flex-1 gap-1">
- <Text className="text-lg text-foreground">{option.label}</Text>
- <Text className="text-sm leading-normal text-foreground-muted">
- {option.description}
- </Text>
- </View>
- {resolved.autoSettleMode === option.mode ? (
- <SymbolView
- name="checkmark"
- size={18}
- tintColor={checkmarkColor}
- type="monochrome"
- weight="semibold"
- />
- ) : null}
- </Pressable>
- ))}
- </SettingsSection>
-
- {resolved.autoSettleMode === "inactivity" ? (
- <SettingsSection title="Inactivity window">
- <View className="flex-row items-center gap-4 p-4">
- <View className="min-w-0 flex-1 gap-1">
- <Text className="text-lg text-foreground">Days without activity</Text>
- <Text className="text-sm text-foreground-muted">Between 1 and 90 days</Text>
- </View>
- <Pressable
- accessibilityLabel="Decrease inactivity days"
- accessibilityRole="button"
- disabled={
- !preferencesReady ||
- resolved.autoSettleAfterDays <= MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS
- }
- onPress={() => setDays(resolved.autoSettleAfterDays - 1)}
- className="size-10 items-center justify-center rounded-full bg-fill-secondary disabled:opacity-40"
- >
- <SymbolView
- name="minus"
- size={16}
- tintColor={checkmarkColor}
- type="monochrome"
- weight="semibold"
- />
- </Pressable>
- <Text className="w-8 text-center text-lg text-foreground">
- {resolved.autoSettleAfterDays}
- </Text>
- <Pressable
- accessibilityLabel="Increase inactivity days"
- accessibilityRole="button"
- disabled={
- !preferencesReady ||
- resolved.autoSettleAfterDays >= MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS
- }
- onPress={() => setDays(resolved.autoSettleAfterDays + 1)}
- className="size-10 items-center justify-center rounded-full bg-fill-secondary disabled:opacity-40"
- >
- <SymbolView
- name="plus"
- size={16}
- tintColor={checkmarkColor}
- type="monochrome"
- weight="semibold"
- />
- </Pressable>
- </View>
- </SettingsSection>
- ) : null}
- </ScrollView>
- </View>
- );
-}
diff --git a/apps/mobile/src/features/settings/SettingsRouteScreen.tsx b/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
index a7b08d97eb7..e781b97de99 100644
--- a/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
+++ b/apps/mobile/src/features/settings/SettingsRouteScreen.tsx
@@ -4,7 +4,6 @@ import Constants from "expo-constants";
import * as Notifications from "expo-notifications";
import { useNavigation } from "@react-navigation/native";
import { NativeStackScreenOptions } from "../../native/StackHeader";
-import { resolveMobileAutoSettlePreferences } from "../../persistence/mobile-preferences";
import { SymbolView } from "../../components/AppSymbol";
import * as Effect from "effect/Effect";
import { AsyncResult } from "effect/unstable/reactivity";
@@ -46,7 +45,6 @@ import { useSavedRemoteConnections } from "../../state/use-remote-environment-re
import { SettingsRow } from "./components/SettingsRow";
import { SettingsSection } from "./components/SettingsSection";
import { SettingsSwitchRow } from "./components/SettingsSwitchRow";
-import { mobileAutoSettleModeLabel } from "./SettingsAutoSettleRouteScreen";
import { resolveAgentAwarenessPlatformPresentation } from "./SettingsRouteScreen.logic";
type NotificationStatus = "checking" | "enabled" | "disabled" | "unsupported";
@@ -530,18 +528,19 @@ function ConfiguredSettingsRouteScreen() {
function GeneralSettingsSection() {
const preferencesResult = useAtomValue(mobilePreferencesAtom);
- const autoSettlePreferences = resolveMobileAutoSettlePreferences(
- AsyncResult.isSuccess(preferencesResult) ? preferencesResult.value : {},
- );
+ const savePreferences = useAtomSet(updateMobilePreferencesAtom);
+ const autoSettleOnMerge =
+ !AsyncResult.isSuccess(preferencesResult) ||
+ preferencesResult.value.autoSettleOnMerge !== false;
return (
<SettingsSection title="General">
<SettingsRow icon="folder" label="Project Grouping" target="SettingsProjectGrouping" />
- <SettingsRow
+ <SettingsSwitchRow
icon="arrow.triangle.branch"
- label="Thread Settling"
- value={mobileAutoSettleModeLabel(autoSettlePreferences.autoSettleMode)}
- target="SettingsAutoSettle"
+ label="Auto-settle merged threads"
+ value={autoSettleOnMerge}
+ onValueChange={(value) => savePreferences({ autoSettleOnMerge: value })}
/>
<SettingsRow icon="chart.bar.xaxis" label="Usage" target="SettingsUsage" />
</SettingsSection>
diff --git a/apps/mobile/src/features/settings/components/settings-sheet-targets.ts b/apps/mobile/src/features/settings/components/settings-sheet-targets.ts
index 7d73fea1a4e..7189fdc2ebe 100644
--- a/apps/mobile/src/features/settings/components/settings-sheet-targets.ts
+++ b/apps/mobile/src/features/settings/components/settings-sheet-targets.ts
@@ -2,7 +2,6 @@ export type SettingsSheetTarget =
| "SettingsEnvironments"
| "SettingsArchive"
| "SettingsAppearance"
- | "SettingsAutoSettle"
| "SettingsProjectGrouping"
| "SettingsClientStorage"
| "SettingsUsage";
diff --git a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
index 74335cd77a3..fd4d0b9d0a6 100644
--- a/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+++ b/apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
@@ -26,7 +26,6 @@ import { ControlPillMenu } from "../../components/ControlPill";
import { SymbolView } from "../../components/AppSymbol";
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
import { NativeStackScreenOptions } from "../../native/StackHeader";
-import { resolveMobileAutoSettlePreferences } from "../../persistence/mobile-preferences";
import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities";
import { useProjects, useThreadShells } from "../../state/entities";
import { mobilePreferencesAtom } from "../../state/preferences";
@@ -166,9 +165,9 @@ function ThreadNavigationSidebarPane(
} = useThreadListActions();
const threadListV2Enabled = useThreadListV2Enabled();
const preferencesResult = useAtomValue(mobilePreferencesAtom);
- const autoSettlePreferences = resolveMobileAutoSettlePreferences(
- AsyncResult.isSuccess(preferencesResult) ? preferencesResult.value : {},
- );
+ const autoSettleOnMerge =
+ !AsyncResult.isSuccess(preferencesResult) ||
+ preferencesResult.value.autoSettleOnMerge !== false;
const pendingTasks = usePendingNewTasks();
const { openPendingTask, confirmDeletePendingTask } = usePendingTaskListActions();
const environments = useMemo(
@@ -511,8 +510,7 @@ function ThreadNavigationSidebarPane(
searchQuery: props.searchQuery,
matchedThreadKeys,
changeRequestByKey,
- autoSettleAfterDays: autoSettlePreferences.autoSettleAfterDays,
- autoSettleMode: autoSettlePreferences.autoSettleMode,
+ autoSettleOnMerge,
settlementEnvironmentIds,
snoozeEnvironmentIds,
settledLimit: settledVisibleCount,
@@ -524,8 +522,7 @@ function ThreadNavigationSidebarPane(
});
}, [
changeRequestByKey,
- autoSettlePreferences.autoSettleAfterDays,
- autoSettlePreferences.autoSettleMode,
+ autoSettleOnMerge,
nowMinute,
snoozeWakeTick,
snoozedShelfExpanded,
diff --git a/apps/mobile/src/features/threads/threadListV2.test.ts b/apps/mobile/src/features/threads/threadListV2.test.ts
index 33281ba456e..24c07eae6da 100644
--- a/apps/mobile/src/features/threads/threadListV2.test.ts
+++ b/apps/mobile/src/features/threads/threadListV2.test.ts
@@ -360,12 +360,10 @@ describe("buildThreadListV2Items", () => {
`${environmentId}:${thread.id}`,
{
state: "merged" as const,
- updatedAt: NOW,
linkedPullRequestKey: '["project-1","pingdotgg/t3code",42]',
},
],
]),
- autoSettleMode: "change-request",
now: NOW,
});
@@ -373,16 +371,16 @@ describe("buildThreadListV2Items", () => {
expect(layout.items[0]?.variant).toBe("slim");
});
- it("keeps a merged thread active when automatic settling is off", () => {
+ it("keeps a merged thread active when auto-settle on merge is off", () => {
const merged = makeThread({ id: ThreadId.make("merged"), title: "Merged" });
const layout = buildThreadListV2Items({
threads: [merged],
environmentId: null,
searchQuery: "",
changeRequestByKey: new Map([
- [`${environmentId}:${merged.id}`, { state: "merged" as const, updatedAt: NOW }],
+ [`${environmentId}:${merged.id}`, { state: "merged" as const }],
]),
- autoSettleMode: "never",
+ autoSettleOnMerge: false,
now: NOW,
});
@@ -451,10 +449,7 @@ describe("buildThreadListV2Items", () => {
threads: [makeThread({ id: ThreadId.make("active"), title: "Active" }), merged],
environmentId: null,
searchQuery: "",
- changeRequestByKey: new Map([
- [`${environmentId}:${merged.id}`, { state: "merged", updatedAt: NOW }],
- ]),
- autoSettleMode: "change-request",
+ changeRequestByKey: new Map([[`${environmentId}:${merged.id}`, { state: "merged" }]]),
now: NOW,
});
@@ -483,7 +478,6 @@ describe("buildThreadListV2Items", () => {
threads: [inactive],
environmentId: null,
searchQuery: "",
- autoSettleMode: "inactivity",
now: NOW,
});
@@ -495,7 +489,7 @@ describe("buildThreadListV2Items", () => {
expect(layout.settledCount).toBe(1);
});
- it("keeps pinned merged threads pinned when automatic settling is off", () => {
+ it("keeps pinned merged threads pinned when auto-settle on merge is off", () => {
const merged = makeThread({
id: ThreadId.make("pinned-merged"),
title: "Pinned merged pull request",
@@ -505,10 +499,8 @@ describe("buildThreadListV2Items", () => {
threads: [merged],
environmentId: null,
searchQuery: "",
- changeRequestByKey: new Map([
- [`${environmentId}:${merged.id}`, { state: "merged", updatedAt: NOW }],
- ]),
- autoSettleMode: "never",
+ changeRequestByKey: new Map([[`${environmentId}:${merged.id}`, { state: "merged" }]]),
+ autoSettleOnMerge: false,
now: NOW,
});
diff --git a/apps/mobile/src/features/threads/threadListV2.ts b/apps/mobile/src/features/threads/threadListV2.ts
index d3565ca7111..be3343a21ba 100644
--- a/apps/mobile/src/features/threads/threadListV2.ts
+++ b/apps/mobile/src/features/threads/threadListV2.ts
@@ -16,12 +16,7 @@ import {
activeThreadAnchorTimestampMs,
sortPinnedThreadsByOrderKey,
} from "@t3tools/client-runtime/state/thread-sort";
-import type {
- EnvironmentId,
- ProjectId,
- SidebarAutoSettleMode,
- ThreadLinkedPullRequest,
-} from "@t3tools/contracts";
+import type { EnvironmentId, ProjectId, ThreadLinkedPullRequest } from "@t3tools/contracts";
import type { PendingNewTask } from "../../state/use-pending-new-tasks";
@@ -374,7 +369,7 @@ export function buildThreadListV2Items(input: {
contract as settlementEnvironmentIds. */
readonly snoozeEnvironmentIds?: ReadonlySet<EnvironmentId>;
readonly autoSettleAfterDays?: number;
- readonly autoSettleMode?: SidebarAutoSettleMode;
+ readonly autoSettleOnMerge?: boolean;
/** Max settled rows to render; the rest are counted, not built. */
readonly settledLimit?: number;
/** Injectable for tests; defaults to now. */
@@ -395,7 +390,7 @@ export function buildThreadListV2Items(input: {
const now = input.now ?? new Date().toISOString();
const snoozeNow = input.snoozeNow ?? now;
const autoSettleAfterDays = input.autoSettleAfterDays ?? 3;
- const autoSettleMode = input.autoSettleMode ?? "never";
+ const autoSettleOnMerge = input.autoSettleOnMerge ?? true;
const query = input.searchQuery.trim().toLocaleLowerCase();
const projectKeys = input.projectRefs
? new Set(input.projectRefs.map((ref) => `${ref.environmentId}:${ref.projectId}`))
@@ -452,7 +447,7 @@ export function buildThreadListV2Items(input: {
effectiveSettled(thread, {
now,
autoSettleAfterDays,
- autoSettleMode,
+ autoSettleOnMerge,
changeRequest,
})
) {
diff --git a/apps/mobile/src/lib/storage.test.ts b/apps/mobile/src/lib/storage.test.ts
index 03ce256826a..a1c7960a570 100644
--- a/apps/mobile/src/lib/storage.test.ts
+++ b/apps/mobile/src/lib/storage.test.ts
@@ -100,7 +100,6 @@ import {
saveConnection,
savePreferencesPatch,
} from "../persistence/imperative";
-import { resolveMobileAutoSettlePreferences } from "../persistence/mobile-preferences";
import { toStableSavedRemoteConnection } from "./connection";
const managedConnection = {
@@ -203,34 +202,6 @@ describe("mobile connection storage", () => {
await expect(loadPreferences()).resolves.toEqual({});
});
- it("defaults retired mobile settling preferences to manual-only", async () => {
- mocks.setPreferencesJson(JSON.stringify({ autoSettleOnMerge: true }), 10);
-
- const preferences = await loadPreferences();
- expect(preferences).toEqual({});
- expect(resolveMobileAutoSettlePreferences(preferences)).toEqual({
- autoSettleMode: "never",
- autoSettleAfterDays: 3,
- });
- });
-
- it("preserves valid mobile settling preferences", async () => {
- mocks.setPreferencesJson(
- JSON.stringify({ autoSettleMode: "inactivity", autoSettleAfterDays: 30 }),
- 10,
- );
-
- const preferences = await loadPreferences();
- expect(preferences).toEqual({
- autoSettleMode: "inactivity",
- autoSettleAfterDays: 30,
- });
- expect(resolveMobileAutoSettlePreferences(preferences)).toEqual({
- autoSettleMode: "inactivity",
- autoSettleAfterDays: 30,
- });
- });
-
it("falls back to secure storage when SQLite cannot save preferences", async () => {
mocks.setDatabaseFailures(true, true);
await expect(savePreferencesPatch({ baseFontSize: 19 })).resolves.toEqual({ baseFontSize: 19 });
diff --git a/apps/mobile/src/persistence/mobile-preferences.ts b/apps/mobile/src/persistence/mobile-preferences.ts
index 083dc0ac90e..5d0bd8a3c9d 100644
--- a/apps/mobile/src/persistence/mobile-preferences.ts
+++ b/apps/mobile/src/persistence/mobile-preferences.ts
@@ -5,15 +5,7 @@ import * as Option from "effect/Option";
import * as Ref from "effect/Ref";
import * as Schema from "effect/Schema";
import * as Semaphore from "effect/Semaphore";
-import {
- DEFAULT_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
- DEFAULT_SIDEBAR_AUTO_SETTLE_MODE,
- MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
- MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
- type SidebarAutoSettleAfterDays,
- type SidebarAutoSettleMode,
- type SidebarProjectGroupingMode,
-} from "@t3tools/contracts";
+import type { SidebarProjectGroupingMode } from "@t3tools/contracts";
import { MOBILE_THEME_IDS, type MobileThemeId, type MobileThemeMode } from "../lib/mobileTheme";
import * as MobileDatabase from "./mobile-database";
@@ -39,8 +31,7 @@ export interface Preferences {
/** @deprecated Kept temporarily so older OTA bundles retain the selected mode. */
readonly projectGroupingEnabled?: boolean;
readonly projectGroupingMode?: SidebarProjectGroupingMode;
- readonly autoSettleMode?: SidebarAutoSettleMode;
- readonly autoSettleAfterDays?: SidebarAutoSettleAfterDays;
+ readonly autoSettleOnMerge?: boolean;
/**
* Device-local mirror of the web `legacySidebarEnabled` setting. Mobile has
* no client-settings sync, so the legacy grouped thread list is opted into
@@ -110,8 +101,7 @@ function sanitizePreferences(parsed: Preferences): Preferences {
collapsedProjectGroups?: readonly string[];
projectGroupingEnabled?: boolean;
projectGroupingMode?: SidebarProjectGroupingMode;
- autoSettleMode?: SidebarAutoSettleMode;
- autoSettleAfterDays?: SidebarAutoSettleAfterDays;
+ autoSettleOnMerge?: boolean;
legacyThreadListEnabled?: boolean;
planModeEnabled?: boolean;
threadListV2SettledShelfExpanded?: boolean;
@@ -177,20 +167,8 @@ function sanitizePreferences(parsed: Preferences): Preferences {
) {
preferences.projectGroupingMode = parsed.projectGroupingMode;
}
- if (
- parsed.autoSettleMode === "never" ||
- parsed.autoSettleMode === "change-request" ||
- parsed.autoSettleMode === "inactivity"
- ) {
- preferences.autoSettleMode = parsed.autoSettleMode;
- }
- if (
- typeof parsed.autoSettleAfterDays === "number" &&
- Number.isInteger(parsed.autoSettleAfterDays) &&
- parsed.autoSettleAfterDays >= MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS &&
- parsed.autoSettleAfterDays <= MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS
- ) {
- preferences.autoSettleAfterDays = parsed.autoSettleAfterDays;
+ if (typeof parsed.autoSettleOnMerge === "boolean") {
+ preferences.autoSettleOnMerge = parsed.autoSettleOnMerge;
}
if (typeof parsed.legacyThreadListEnabled === "boolean") {
preferences.legacyThreadListEnabled = parsed.legacyThreadListEnabled;
@@ -207,16 +185,6 @@ function sanitizePreferences(parsed: Preferences): Preferences {
return preferences;
}
-export function resolveMobileAutoSettlePreferences(preferences: Preferences): {
- readonly autoSettleMode: SidebarAutoSettleMode;
- readonly autoSettleAfterDays: SidebarAutoSettleAfterDays;
-} {
- return {
- autoSettleMode: preferences.autoSettleMode ?? DEFAULT_SIDEBAR_AUTO_SETTLE_MODE,
- autoSettleAfterDays: preferences.autoSettleAfterDays ?? DEFAULT_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
- };
-}
-
export const make = Effect.fn("MobilePreferencesStore.make")(function* () {
const database = yield* MobileDatabase.MobileDatabase;
const secureStorage = yield* MobileSecureStorage.MobileSecureStorage;
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 8eeb7a75965..42e61850048 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -4394,7 +4394,7 @@ function ChatViewContent(props: ChatViewProps) {
? activePlan.steps
: null;
const autoSettleAfterDays = useClientSettings((settings) => settings.sidebarAutoSettleAfterDays);
- const autoSettleMode = useClientSettings((settings) => settings.sidebarAutoSettleMode);
+ const autoSettleOnMerge = useClientSettings((settings) => settings.sidebarAutoSettleOnMerge);
const linkedPullRequestStatus = useLinkedThreadPullRequest(
activeThreadRef?.environmentId ?? null,
linkedThreadPullRequest,
@@ -4465,8 +4465,10 @@ function ChatViewContent(props: ChatViewProps) {
const activeThreadWokeVisible = useMemo(() => {
if (activeThreadWokeAt === null) return false;
if (
- autoSettleMode === "change-request" &&
- changeRequestAutoSettles(activeThreadChangeRequest, { thread: activeThreadShell })
+ changeRequestAutoSettles(activeThreadChangeRequest, {
+ autoSettleOnMerge,
+ thread: activeThreadShell,
+ })
) {
return false;
}
@@ -4492,21 +4494,21 @@ function ChatViewContent(props: ChatViewProps) {
activeThreadChangeRequest,
activeThreadShell,
activeThreadWokeAt,
- autoSettleMode,
+ autoSettleOnMerge,
]);
const activeThreadSettled = useMemo(() => {
if (activeThreadShell === null || !supportsSettlement) return false;
return effectiveSettled(activeThreadShell, {
now: `${nowMinute}:00.000Z`,
autoSettleAfterDays,
- autoSettleMode,
+ autoSettleOnMerge,
changeRequest: activeThreadChangeRequest,
});
}, [
activeThreadChangeRequest,
activeThreadShell,
autoSettleAfterDays,
- autoSettleMode,
+ autoSettleOnMerge,
changeRequestSnapshotByKey,
nowMinute,
supportsSettlement,
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index 6d1495340bd..eda2f784698 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -31,7 +31,7 @@ import {
scopedThreadKey,
} from "@t3tools/client-runtime/environment";
import type { ScopedThreadRef, ThreadId } from "@t3tools/contracts";
-import type { SidebarAutoSettleMode, TimestampFormat } from "@t3tools/contracts/settings";
+import type { TimestampFormat } from "@t3tools/contracts/settings";
import {
AlarmClockIcon,
AlarmClockOffIcon,
@@ -714,7 +714,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
// False on environments whose server predates thread.settle/unsettle:
// the lifecycle affordances hide entirely rather than fail on click.
settlementSupported: boolean;
- autoSettleMode: SidebarAutoSettleMode;
+ autoSettleOnMerge: boolean;
// Same contract for thread.snooze/unsnooze.
snoozeSupported: boolean;
// Pinned threads show the same pin marker in active, settled, and snoozed
@@ -839,7 +839,10 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: {
const isWoke =
wokeAtDate !== null &&
(lastVisitedDate === null || lastVisitedDate < wokeAtDate) &&
- !(props.autoSettleMode === "change-request" && changeRequestAutoSettles(pr, { thread }));
+ !changeRequestAutoSettles(pr, {
+ autoSettleOnMerge: props.autoSettleOnMerge,
+ thread,
+ });
// In-flight rows (working, or waiting on approval/input) fade as a whole:
// there is nothing for the user to do yet, so prominence is reserved for
// rows that need a human — done (unread), read-but-unsettled, failed, and
@@ -1737,7 +1740,7 @@ export default function Sidebar() {
const { isMobile, setOpenMobile } = useSidebar();
const keybindings = useAtomValue(primaryServerKeybindingsAtom);
const autoSettleAfterDays = useClientSettings((s) => s.sidebarAutoSettleAfterDays);
- const autoSettleMode = useClientSettings((s) => s.sidebarAutoSettleMode);
+ const autoSettleOnMerge = useClientSettings((s) => s.sidebarAutoSettleOnMerge);
const confirmThreadDelete = useClientSettings((s) => s.confirmThreadDelete);
const confirmThreadArchive = useClientSettings((s) => s.confirmThreadArchive);
const sidebarProjectSortOrder = useClientSettings((s) => s.sidebarProjectSortOrder);
@@ -2122,7 +2125,7 @@ export default function Sidebar() {
effectiveSettled(thread, {
now,
autoSettleAfterDays,
- autoSettleMode,
+ autoSettleOnMerge,
changeRequest,
})
) {
@@ -2161,7 +2164,7 @@ export default function Sidebar() {
};
}, [
autoSettleAfterDays,
- autoSettleMode,
+ autoSettleOnMerge,
changeRequestSnapshotByKey,
nowMinute,
scopedProjectKeys,
@@ -3784,7 +3787,7 @@ export default function Sidebar() {
serverConfigs.get(thread.environmentId)?.environment.capabilities
.threadSettlement === true
}
- autoSettleMode={autoSettleMode}
+ autoSettleOnMerge={autoSettleOnMerge}
snoozeSupported={
serverConfigs.get(thread.environmentId)?.environment.capabilities
.threadSnooze === true
diff --git a/apps/web/src/components/ThreadStatusIndicators.test.ts b/apps/web/src/components/ThreadStatusIndicators.test.ts
index 578419e7be6..3710bcea8b8 100644
--- a/apps/web/src/components/ThreadStatusIndicators.test.ts
+++ b/apps/web/src/components/ThreadStatusIndicators.test.ts
@@ -47,7 +47,6 @@ function mergedFeaturePr(): NonNullable<VcsStatusResult["pr"]> {
baseRef: "main",
headRef: "feature/current",
state: "merged",
- updatedAt: "2026-04-10T00:00:00.000Z",
};
}
@@ -546,7 +545,6 @@ describe("resolveDisplayedThreadPr + nextThreadChangeRequestSnapshot", () => {
effectiveSettled(shell, {
now: "2026-04-10T00:00:00.000Z",
autoSettleAfterDays: null,
- autoSettleMode: "change-request",
changeRequest: displayed,
}),
).toBe(true);
diff --git a/apps/web/src/components/settings/SettingsPanels.logic.test.ts b/apps/web/src/components/settings/SettingsPanels.logic.test.ts
index 66f86d30130..5c715eb4eb2 100644
--- a/apps/web/src/components/settings/SettingsPanels.logic.test.ts
+++ b/apps/web/src/components/settings/SettingsPanels.logic.test.ts
@@ -14,10 +14,9 @@ import {
formatDiagnosticsDescription,
getChangedBrowserSettingLabels,
getChangedTypographySettingLabels,
+ isSamePreviewViewport,
hasChangedBackgroundActivitySettings,
- hasChangedThreadSettlingSettings,
isProjectGroupingEnabled,
- isSamePreviewViewport,
projectGroupingModeFromToggle,
resolveBackgroundActivityProfileOption,
} from "./SettingsPanels.logic";
@@ -153,24 +152,6 @@ describe("project grouping toggle", () => {
});
});
-describe("thread settling settings restore", () => {
- it("detects changes to the mode or the hidden inactivity window", () => {
- expect(hasChangedThreadSettlingSettings(DEFAULT_UNIFIED_SETTINGS)).toBe(false);
- expect(
- hasChangedThreadSettlingSettings({
- ...DEFAULT_UNIFIED_SETTINGS,
- sidebarAutoSettleMode: "inactivity",
- }),
- ).toBe(true);
- expect(
- hasChangedThreadSettlingSettings({
- ...DEFAULT_UNIFIED_SETTINGS,
- sidebarAutoSettleAfterDays: 30,
- }),
- ).toBe(true);
- });
-});
-
describe("formatDiagnosticsDescription", () => {
it("collapses trace and metric URLs that share the same OTEL base path", () => {
expect(
diff --git a/apps/web/src/components/settings/SettingsPanels.logic.ts b/apps/web/src/components/settings/SettingsPanels.logic.ts
index 4d6cb9aaf8e..a5d5d995849 100644
--- a/apps/web/src/components/settings/SettingsPanels.logic.ts
+++ b/apps/web/src/components/settings/SettingsPanels.logic.ts
@@ -31,15 +31,6 @@ export function projectGroupingModeFromToggle(
return lastEnabledMode === "repository_path" ? "repository_path" : "repository";
}
-export function hasChangedThreadSettlingSettings(
- settings: Pick<UnifiedSettings, "sidebarAutoSettleMode" | "sidebarAutoSettleAfterDays">,
-): boolean {
- return (
- settings.sidebarAutoSettleMode !== DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleMode ||
- settings.sidebarAutoSettleAfterDays !== DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays
- );
-}
-
const LAST_ENABLED_PROJECT_GROUPING_MODE_KEY = "t3code:last-enabled-project-grouping-mode";
export function readLastEnabledProjectGroupingMode(): SidebarProjectGroupingMode {
diff --git a/apps/web/src/components/settings/SettingsPanels.tsx b/apps/web/src/components/settings/SettingsPanels.tsx
index 1d373bec334..b486a0eefea 100644
--- a/apps/web/src/components/settings/SettingsPanels.tsx
+++ b/apps/web/src/components/settings/SettingsPanels.tsx
@@ -8,7 +8,6 @@ import {
type DesktopUpdateChannel,
ProviderDriverKind,
type ScopedThreadRef,
- type SidebarAutoSettleMode,
type SidebarProjectGroupingMode,
} from "@t3tools/contracts";
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
@@ -131,7 +130,6 @@ import {
normalizeIntervalSeconds,
PROVIDER_HEALTH_INTERVAL_STEP_SECONDS,
hasChangedBackgroundActivitySettings,
- hasChangedThreadSettlingSettings,
isProjectGroupingEnabled,
projectGroupingModeFromToggle,
readLastEnabledProjectGroupingMode,
@@ -473,7 +471,6 @@ export function useSettingsRestore(onRestored?: () => void) {
DEFAULT_UNIFIED_SETTINGS.textGenerationModelSelection ?? null,
);
const isBackgroundActivityDirty = hasChangedBackgroundActivitySettings(settings);
- const isThreadSettlingDirty = hasChangedThreadSettlingSettings(settings);
const changedSettingLabels = useMemo(
() => [
@@ -498,7 +495,13 @@ export function useSettingsRestore(onRestored?: () => void) {
DEFAULT_UNIFIED_SETTINGS.sidebarProjectGroupingMode
? ["Project Grouping"]
: []),
- ...(isThreadSettlingDirty ? ["Thread settling"] : []),
+ ...(settings.sidebarAutoSettleAfterDays !==
+ DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays
+ ? ["Auto-settle inactive threads"]
+ : []),
+ ...(settings.sidebarAutoSettleOnMerge !== DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleOnMerge
+ ? ["Auto-settle merged threads"]
+ : []),
...(settings.wordWrap !== DEFAULT_UNIFIED_SETTINGS.wordWrap ? ["Word wrap"] : []),
...getChangedTypographySettingLabels(settings),
...(settings.diffIgnoreWhitespace !== DEFAULT_UNIFIED_SETTINGS.diffIgnoreWhitespace
@@ -547,7 +550,6 @@ export function useSettingsRestore(onRestored?: () => void) {
[
isTextGenerationModelDirty,
isBackgroundActivityDirty,
- isThreadSettlingDirty,
settings.browserDefaultViewport,
settings.browserDefaultZoomFactor,
settings.browserDefaultAppearance,
@@ -574,6 +576,8 @@ export function useSettingsRestore(onRestored?: () => void) {
settings.glassOpacity,
settings.enableLegacyTokenStreaming,
settings.enableProviderUpdateChecks,
+ settings.sidebarAutoSettleAfterDays,
+ settings.sidebarAutoSettleOnMerge,
settings.sidebarProjectGroupingMode,
settings.sidebarThreadPreviewCount,
settings.showSkillsInSlashMenu,
@@ -658,7 +662,7 @@ export function useSettingsRestore(onRestored?: () => void) {
sidebarThreadPreviewCount: DEFAULT_UNIFIED_SETTINGS.sidebarThreadPreviewCount,
sidebarProjectGroupingMode: DEFAULT_UNIFIED_SETTINGS.sidebarProjectGroupingMode,
sidebarAutoSettleAfterDays: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays,
- sidebarAutoSettleMode: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleMode,
+ sidebarAutoSettleOnMerge: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleOnMerge,
enableLegacyTokenStreaming: DEFAULT_UNIFIED_SETTINGS.enableLegacyTokenStreaming,
enableProviderUpdateChecks: DEFAULT_UNIFIED_SETTINGS.enableProviderUpdateChecks,
backgroundActivity: DEFAULT_UNIFIED_SETTINGS.backgroundActivity,
@@ -1686,11 +1690,6 @@ function FontFamilySettingsRow({
}
const AUTO_SETTLE_DEFAULT_DAYS = DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays ?? 3;
-const AUTO_SETTLE_MODE_LABELS: Readonly<Record<SidebarAutoSettleMode, string>> = {
- never: "Never (manual only)",
- "change-request": "When PR merges or closes",
- inactivity: "After inactivity",
-};
function AutoSettleDaysInput({
value,
@@ -1952,59 +1951,67 @@ export function GeneralSettingsPanel() {
/>
<SettingsRow
- {...searchableSetting("thread-settling")}
- description="Choose the only event allowed to settle a thread automatically. Manual settling always remains available."
+ {...searchableSetting("auto-settle-merged-threads")}
+ description="Settle a thread when its pull request merges. Closed pull requests still settle automatically."
resetAction={
- hasChangedThreadSettlingSettings(settings) ? (
+ settings.sidebarAutoSettleOnMerge !==
+ DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleOnMerge ? (
<SettingResetButton
- label="thread settling"
+ label="auto-settle on merge"
onClick={() =>
updateSettings({
- sidebarAutoSettleMode: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleMode,
- sidebarAutoSettleAfterDays: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays,
+ sidebarAutoSettleOnMerge: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleOnMerge,
})
}
/>
) : null
}
control={
- <Select
- value={settings.sidebarAutoSettleMode}
- onValueChange={(value) => {
- if (value === "never" || value === "change-request" || value === "inactivity") {
+ <Switch
+ checked={settings.sidebarAutoSettleOnMerge}
+ onCheckedChange={(checked) =>
+ updateSettings({ sidebarAutoSettleOnMerge: Boolean(checked) })
+ }
+ aria-label="Auto-settle merged threads"
+ />
+ }
+ />
+
+ <SettingsRow
+ {...searchableSetting("auto-settle-inactive-threads")}
+ description="Sidebar threads with no activity for this long settle automatically."
+ resetAction={
+ settings.sidebarAutoSettleAfterDays !==
+ DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays ? (
+ <SettingResetButton
+ label="auto-settle"
+ onClick={() =>
updateSettings({
- sidebarAutoSettleMode: value,
- ...(value === "inactivity" && settings.sidebarAutoSettleAfterDays === null
- ? { sidebarAutoSettleAfterDays: AUTO_SETTLE_DEFAULT_DAYS }
- : {}),
- });
+ sidebarAutoSettleAfterDays: DEFAULT_UNIFIED_SETTINGS.sidebarAutoSettleAfterDays,
+ })
}
- }}
- >
- <SelectTrigger className="w-full sm:w-64" aria-label="Thread settling">
- <SelectValue>{AUTO_SETTLE_MODE_LABELS[settings.sidebarAutoSettleMode]}</SelectValue>
- </SelectTrigger>
- <SelectPopup align="end" alignItemWithTrigger={false}>
- <SelectItem hideIndicator value="never">
- {AUTO_SETTLE_MODE_LABELS.never}
- </SelectItem>
- <SelectItem hideIndicator value="change-request">
- {AUTO_SETTLE_MODE_LABELS["change-request"]}
- </SelectItem>
- <SelectItem hideIndicator value="inactivity">
- {AUTO_SETTLE_MODE_LABELS.inactivity}
- </SelectItem>
- </SelectPopup>
- </Select>
+ />
+ ) : null
+ }
+ control={
+ <Switch
+ checked={settings.sidebarAutoSettleAfterDays !== null}
+ onCheckedChange={(checked) =>
+ updateSettings({
+ sidebarAutoSettleAfterDays: checked ? AUTO_SETTLE_DEFAULT_DAYS : null,
+ })
+ }
+ aria-label="Auto-settle inactive threads"
+ />
}
/>
- {settings.sidebarAutoSettleMode === "inactivity" ? (
+ {settings.sidebarAutoSettleAfterDays !== null ? (
<SettingsRow
title="Days of inactivity before auto-settle"
- description="Running, blocked, and open-pull-request threads always stay active."
+ description="Any new activity un-settles a thread automatically."
control={
<AutoSettleDaysInput
- value={settings.sidebarAutoSettleAfterDays ?? AUTO_SETTLE_DEFAULT_DAYS}
+ value={settings.sidebarAutoSettleAfterDays}
onCommit={(days) => updateSettings({ sidebarAutoSettleAfterDays: days })}
/>
}
diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts
index 48f38c5de77..b924f5f6a51 100644
--- a/apps/web/src/components/settings/settingsSearch.ts
+++ b/apps/web/src/components/settings/settingsSearch.ts
@@ -112,8 +112,13 @@ export const SETTINGS_SEARCH_ITEMS = [
to: "/settings/general",
},
{
- id: "thread-settling",
- title: "Thread settling",
+ id: "auto-settle-inactive-threads",
+ title: "Auto-settle inactive threads",
+ to: "/settings/general",
+ },
+ {
+ id: "auto-settle-merged-threads",
+ title: "Auto-settle merged threads",
to: "/settings/general",
},
{
diff --git a/apps/web/src/hooks/useThreadActionMenu.ts b/apps/web/src/hooks/useThreadActionMenu.ts
index 33faface4da..1602e5cf816 100644
--- a/apps/web/src/hooks/useThreadActionMenu.ts
+++ b/apps/web/src/hooks/useThreadActionMenu.ts
@@ -81,7 +81,7 @@ export function useThreadActionMenu(input: {
const handleNewThread = useNewThreadHandler();
const markThreadUnread = useUiStateStore((s) => s.markThreadUnread);
const autoSettleAfterDays = useClientSettings((s) => s.sidebarAutoSettleAfterDays);
- const autoSettleMode = useClientSettings((s) => s.sidebarAutoSettleMode);
+ const autoSettleOnMerge = useClientSettings((s) => s.sidebarAutoSettleOnMerge);
const confirmThreadDelete = useClientSettings((s) => s.confirmThreadDelete);
const confirmThreadArchive = useClientSettings((s) => s.confirmThreadArchive);
const timestampFormat = useClientSettings((s) => s.timestampFormat);
@@ -135,7 +135,7 @@ export function useThreadActionMenu(input: {
// parked-thread banner within the same minute.
now: `${now.toISOString().slice(0, 16)}:00.000Z`,
autoSettleAfterDays,
- autoSettleMode,
+ autoSettleOnMerge,
changeRequest,
}),
isSnoozed: supports.snooze && effectiveSnoozed(thread, { now: now.toISOString() }),
@@ -312,7 +312,7 @@ export function useThreadActionMenu(input: {
[
archiveThread,
autoSettleAfterDays,
- autoSettleMode,
+ autoSettleOnMerge,
changeRequest,
confirmThreadArchive,
confirmThreadDelete,
diff --git a/docs/user/thread-sidebar.md b/docs/user/thread-sidebar.md
index 71cab128cbd..f0fbfdccbd6 100644
--- a/docs/user/thread-sidebar.md
+++ b/docs/user/thread-sidebar.md
@@ -7,19 +7,15 @@ their project, including when you connect to more than one environment.
To require confirmation before unpinning, enable **Settings → General → Unpin confirmation**. The
confirmation applies to the sidebar controls, thread menus, and the `mod+shift+p` shortcut.
-Pinned threads follow the auto-settle policy in **Settings → General**. Choose exactly one policy:
-settle when a pull request merges or closes, settle after a configurable period of inactivity, or
-never auto-settle. **Never** leaves every automatic path off, so threads settle only when you choose
-**Settle**.
+Pinned threads still move to **Settled** when they become inactive. They also move when their pull
+request merges if **Auto-settle merged threads** is enabled.
When you un-settle a thread, it returns to the top of the active list so you can find it right
away. Its timestamps do not change. Other threads keep their positions.
Right-click a pull request link in a thread and choose **Link to thread** to show that pull request
-in the sidebar. The thread settles when the linked pull request merges or closes only when the
-pull-request policy is selected. Right-click the same link and choose **Unlink from thread** to
-remove it. If T3 Code cannot determine when a pull request entered its terminal state, it keeps the
-thread active.
+in the sidebar. The thread settles when the linked pull request merges if **Auto-settle merged
+threads** is enabled. Right-click the same link and choose **Unlink from thread** to remove it.
On web and desktop, drag a pinned thread to change its position. On mobile, open the thread's menu
and choose **Move up** or **Move down**. The order is stored by the server and appears on your
diff --git a/oxlint-plugin-t3code/rules/no-mobile-uniwind-theme-escape-hatches.ts b/oxlint-plugin-t3code/rules/no-mobile-uniwind-theme-escape-hatches.ts
index 96bd03aae56..5e6a7111e81 100644
--- a/oxlint-plugin-t3code/rules/no-mobile-uniwind-theme-escape-hatches.ts
+++ b/oxlint-plugin-t3code/rules/no-mobile-uniwind-theme-escape-hatches.ts
@@ -17,7 +17,6 @@ const THEME_INTEROP_ALLOWLIST = new Set([
"features/home/HomeHeader.tsx",
"features/review/ReviewSheet.tsx",
"features/review/useNativeReviewDiffBridge.ts",
- "features/settings/SettingsAutoSettleRouteScreen.tsx",
"features/settings/SettingsEnvironmentsRouteScreen.tsx",
"features/settings/appearance/components/AppearancePreviews.tsx",
"features/settings/appearance/components/FontSizeSliderRow.tsx",
diff --git a/packages/client-runtime/src/state/threadSettled.test.ts b/packages/client-runtime/src/state/threadSettled.test.ts
index caf516c50eb..06a8bb32c79 100644
--- a/packages/client-runtime/src/state/threadSettled.test.ts
+++ b/packages/client-runtime/src/state/threadSettled.test.ts
@@ -21,6 +21,18 @@ const FRESH = "2026-04-09T00:00:00.000Z";
const STALE = "2026-04-06T23:59:59.999Z";
describe("changeRequestAutoSettles", () => {
+ it.each([
+ ["open", true, false],
+ ["merged", true, true],
+ ["merged", false, false],
+ ["closed", false, true],
+ [null, false, false],
+ ] as const)("state=%s autoSettleOnMerge=%s returns %s", (state, autoSettleOnMerge, expected) => {
+ expect(changeRequestAutoSettles(state === null ? null : { state }, { autoSettleOnMerge })).toBe(
+ expected,
+ );
+ });
+
const THREAD_CREATED_AT = "2026-04-01T00:00:00.000Z";
const idleThread = {
createdAt: THREAD_CREATED_AT,
@@ -28,19 +40,6 @@ describe("changeRequestAutoSettles", () => {
latestTurn: null,
};
- it.each([
- ["open", false],
- ["merged", true],
- ["closed", true],
- [null, false],
- ] as const)("state=%s returns %s", (state, expected) => {
- expect(
- changeRequestAutoSettles(state === null ? null : { state, updatedAt: THREAD_CREATED_AT }, {
- thread: idleThread,
- }),
- ).toBe(expected);
- });
-
it("ignores a terminal change request last touched before the thread existed", () => {
for (const state of ["merged", "closed"] as const) {
expect(
@@ -106,20 +105,20 @@ describe("changeRequestAutoSettles", () => {
).toBe(true);
});
- it("keeps the thread active when either timestamp is missing or malformed", () => {
- expect(changeRequestAutoSettles({ state: "merged" }, { thread: idleThread })).toBe(false);
+ it("falls back to settling when either timestamp is missing or malformed", () => {
+ expect(changeRequestAutoSettles({ state: "merged" }, { thread: idleThread })).toBe(true);
expect(
changeRequestAutoSettles({ state: "merged", updatedAt: null }, { thread: idleThread }),
- ).toBe(false);
+ ).toBe(true);
expect(
changeRequestAutoSettles({ state: "merged", updatedAt: "2026-03-01T00:00:00.000Z" }, {}),
- ).toBe(false);
+ ).toBe(true);
expect(
changeRequestAutoSettles(
{ state: "merged", updatedAt: "not-a-date" },
{ thread: idleThread },
),
- ).toBe(false);
+ ).toBe(true);
});
});
@@ -205,47 +204,38 @@ describe("effectiveSettled", () => {
] as const;
const runningCases = [false, true] as const;
const pendingCases = [undefined, "approval", "user-input"] as const;
- const autoSettleModes = ["never", "change-request", "inactivity"] as const;
- const truthTable = autoSettleModes.flatMap((autoSettleMode) =>
- overrideCases.flatMap((settledOverride) =>
- changeRequestStates.flatMap((changeRequestState) =>
- inactivityCases.flatMap(([inactivity, activityAt]) =>
- runningCases.flatMap((running) =>
- pendingCases.map((pending) => ({
- autoSettleMode,
- settledOverride,
- changeRequestState,
- inactivity,
- activityAt,
- running,
- pending,
- expected:
- pending === undefined &&
- !running &&
- (settledOverride === "settled" ||
- (settledOverride === null &&
- ((autoSettleMode === "change-request" && changeRequestState === "merged") ||
- (autoSettleMode === "inactivity" &&
- changeRequestState !== "open" &&
- inactivity === "stale")))),
- })),
- ),
+ const truthTable = overrideCases.flatMap((settledOverride) =>
+ changeRequestStates.flatMap((changeRequestState) =>
+ inactivityCases.flatMap(([inactivity, activityAt]) =>
+ runningCases.flatMap((running) =>
+ pendingCases.map((pending) => ({
+ settledOverride,
+ changeRequestState,
+ inactivity,
+ activityAt,
+ running,
+ pending,
+ // Settled iff nothing blocks (pending work / live session) AND
+ // the override says settled, or (with no override) a merged PR
+ // or staleness auto-settles. The "active" pin suppresses both
+ // auto signals, and an open PR suppresses the inactivity path:
+ // a thread with a PR out for review is never done, however quiet.
+ expected:
+ pending === undefined &&
+ !running &&
+ (settledOverride === "settled" ||
+ (settledOverride === null &&
+ (changeRequestState === "merged" ||
+ (changeRequestState !== "open" && inactivity === "stale")))),
+ })),
),
),
),
);
it.each(truthTable)(
- "mode=$autoSettleMode override=$settledOverride pr=$changeRequestState inactivity=$inactivity running=$running pending=$pending",
- ({
- autoSettleMode,
- settledOverride,
- changeRequestState,
- activityAt,
- running,
- pending,
- expected,
- }) => {
+ "override=$settledOverride pr=$changeRequestState inactivity=$inactivity running=$running pending=$pending",
+ ({ settledOverride, changeRequestState, activityAt, running, pending, expected }) => {
const shell = makeShell({
settledOverride,
activityAt,
@@ -255,18 +245,12 @@ describe("effectiveSettled", () => {
const changeRequestOptions =
changeRequestState === undefined
? {}
- : {
- changeRequest: {
- state: changeRequestState as ChangeRequestStateLike,
- updatedAt: NOW,
- },
- };
+ : { changeRequest: { state: changeRequestState as ChangeRequestStateLike } };
expect(
effectiveSettled(shell, {
now: NOW,
autoSettleAfterDays: 3,
- autoSettleMode,
...changeRequestOptions,
}),
).toBe(expected);
@@ -279,8 +263,7 @@ describe("effectiveSettled", () => {
effectiveSettled(shell, {
now: NOW,
autoSettleAfterDays: null,
- autoSettleMode: "change-request",
- changeRequest: { state: "closed", updatedAt: NOW },
+ changeRequest: { state: "closed" },
}),
).toBe(true);
});
@@ -292,8 +275,7 @@ describe("effectiveSettled", () => {
effectiveSettled(recentlyActive, {
now: NOW,
autoSettleAfterDays: null,
- autoSettleMode: "change-request",
- changeRequest: { state: changeRequestState, updatedAt: NOW },
+ changeRequest: { state: changeRequestState },
}),
).toBe(true);
}
@@ -309,7 +291,6 @@ describe("effectiveSettled", () => {
effectiveSettled(fresh, {
now: NOW,
autoSettleAfterDays: null,
- autoSettleMode: "change-request",
changeRequest: { state, updatedAt: "2026-03-20T00:00:00.000Z" },
}),
).toBe(false);
@@ -319,24 +300,30 @@ describe("effectiveSettled", () => {
effectiveSettled(fresh, {
now: NOW,
autoSettleAfterDays: null,
- autoSettleMode: "change-request",
changeRequest: { state: "merged", updatedAt: "2026-04-09T00:00:00.000Z" },
}),
).toBe(true);
});
- it("keeps a merged change request active in every other mode", () => {
+ it("can keep a merged change request active", () => {
const recentlyActive = makeShell({ activityAt: "2026-04-09T23:59:59.999Z" });
- for (const autoSettleMode of ["never", "inactivity"] as const) {
- expect(
- effectiveSettled(recentlyActive, {
- now: NOW,
- autoSettleAfterDays: null,
- autoSettleMode,
- changeRequest: { state: "merged", updatedAt: NOW },
- }),
- ).toBe(false);
- }
+ expect(
+ effectiveSettled(recentlyActive, {
+ now: NOW,
+ autoSettleAfterDays: null,
+ autoSettleOnMerge: false,
+ changeRequest: { state: "merged" },
+ }),
+ ).toBe(false);
+
+ expect(
+ effectiveSettled(recentlyActive, {
+ now: NOW,
+ autoSettleAfterDays: null,
+ autoSettleOnMerge: false,
+ changeRequest: { state: "closed" },
+ }),
+ ).toBe(true);
});
it("never auto-settles a stale thread with an open change request", () => {
@@ -345,7 +332,6 @@ describe("effectiveSettled", () => {
effectiveSettled(stale, {
now: NOW,
autoSettleAfterDays: 3,
- autoSettleMode: "inactivity",
changeRequest: { state: "open" },
}),
).toBe(false);
@@ -355,7 +341,6 @@ describe("effectiveSettled", () => {
effectiveSettled(settled, {
now: NOW,
autoSettleAfterDays: 3,
- autoSettleMode: "inactivity",
changeRequest: { state: "open" },
}),
).toBe(true);
@@ -370,8 +355,7 @@ describe("effectiveSettled", () => {
effectiveSettled(shell, {
now: NOW,
autoSettleAfterDays: null,
- autoSettleMode: "change-request",
- changeRequest: { state: "merged", updatedAt: NOW },
+ changeRequest: { state: "merged" },
}),
).toBe(false);
});
@@ -386,8 +370,7 @@ describe("effectiveSettled", () => {
effectiveSettled(shell, {
now: NOW,
autoSettleAfterDays: 3,
- autoSettleMode: "change-request",
- changeRequest: { state: "merged", updatedAt: NOW },
+ changeRequest: { state: "merged" },
}),
).toBe(false);
});
@@ -431,8 +414,7 @@ describe("effectiveSettled", () => {
effectiveSettled(shell, {
now: transitionNow,
autoSettleAfterDays: 3,
- autoSettleMode: "change-request",
- changeRequest: { state: "merged", updatedAt: transitionNow },
+ changeRequest: { state: "merged" },
}),
).toBe(false);
}
@@ -444,20 +426,8 @@ describe("effectiveSettled", () => {
});
const stale = makeShell({ activityAt: STALE });
- expect(
- effectiveSettled(boundary, {
- now: NOW,
- autoSettleAfterDays: 3,
- autoSettleMode: "inactivity",
- }),
- ).toBe(false);
- expect(
- effectiveSettled(stale, {
- now: NOW,
- autoSettleAfterDays: null,
- autoSettleMode: "inactivity",
- }),
- ).toBe(false);
+ expect(effectiveSettled(boundary, { now: NOW, autoSettleAfterDays: 3 })).toBe(false);
+ expect(effectiveSettled(stale, { now: NOW, autoSettleAfterDays: null })).toBe(false);
});
});
@@ -562,8 +532,7 @@ describe("canSettle", () => {
effectiveSettled(queued, {
now: justAfter,
autoSettleAfterDays: 3,
- autoSettleMode: "change-request",
- changeRequest: { state: "merged", updatedAt: justAfter },
+ changeRequest: { state: "merged" },
}),
).toBe(false);
// Past the window the message is a failed/stale start: settleable again.
@@ -585,13 +554,9 @@ describe("canSettle", () => {
settledAt: "2026-04-09T12:02:10.000Z",
};
expect(hasQueuedTurnStart(settledAfterMessage, { now: flooredNow })).toBe(true);
- expect(
- effectiveSettled(settledAfterMessage, {
- now: flooredNow,
- autoSettleAfterDays: 3,
- autoSettleMode: "never",
- }),
- ).toBe(true);
+ expect(effectiveSettled(settledAfterMessage, { now: flooredNow, autoSettleAfterDays: 3 })).toBe(
+ true,
+ );
// A message NEWER than settledAt is genuinely new work: still blocked
// until the server's auto-unsettle lands.
@@ -604,7 +569,6 @@ describe("canSettle", () => {
effectiveSettled(messageAfterSettle, {
now: "2026-04-09T12:03:30.000Z",
autoSettleAfterDays: 3,
- autoSettleMode: "never",
}),
).toBe(false);
});
@@ -618,12 +582,6 @@ describe("canSettle", () => {
pending: "user-input",
});
expect(canSettle(blocked, { now: NOW })).toBe(false);
- expect(
- effectiveSettled(blocked, {
- now: NOW,
- autoSettleAfterDays: 3,
- autoSettleMode: "never",
- }),
- ).toBe(false);
+ expect(effectiveSettled(blocked, { now: NOW, autoSettleAfterDays: 3 })).toBe(false);
});
});
diff --git a/packages/client-runtime/src/state/threadSettled.ts b/packages/client-runtime/src/state/threadSettled.ts
index 40a6c7b7a27..8ccf0d230ef 100644
--- a/packages/client-runtime/src/state/threadSettled.ts
+++ b/packages/client-runtime/src/state/threadSettled.ts
@@ -1,5 +1,5 @@
// @effect-diagnostics globalDate:off -- UI snooze presets use local calendar boundaries and Intl labels.
-import type { OrchestrationThreadShell, SidebarAutoSettleMode } from "@t3tools/contracts";
+import type { OrchestrationThreadShell } from "@t3tools/contracts";
export type ChangeRequestStateLike = "open" | "closed" | "merged";
@@ -46,22 +46,26 @@ function threadUserActivityAnchorAt(thread: ThreadActivitySource): string {
* thread started at a worktree root whose PR already merged), and one older
* than the user's latest engagement was already adjudicated — re-engaging a
* thread whose PR merged is the user saying the conversation outlived the
- * PR. Missing or malformed timestamps keep the thread active: an automatic
- * transition must have enough evidence to be predictable.
+ * PR. Unknown timestamps keep the old always-settle behavior.
*/
export function changeRequestAutoSettles(
changeRequest: ChangeRequestSettleSource | null | undefined,
options: {
+ readonly autoSettleOnMerge?: boolean | undefined;
readonly thread?: ThreadActivitySource | null | undefined;
} = {},
): boolean {
if (changeRequest == null) return false;
- const terminal = changeRequest.state === "closed" || changeRequest.state === "merged";
+ const terminal =
+ changeRequest.state === "closed" ||
+ (changeRequest.state === "merged" && options.autoSettleOnMerge !== false);
if (!terminal) return false;
- if (changeRequest.updatedAt == null || options.thread == null) return false;
+ if (changeRequest.updatedAt == null || options.thread == null) return true;
const updatedAtMs = Date.parse(changeRequest.updatedAt);
const anchorAtMs = Date.parse(threadUserActivityAnchorAt(options.thread));
- if (Number.isNaN(updatedAtMs) || Number.isNaN(anchorAtMs)) return false;
+ // Malformed timestamps fall back to settling, matching servers that never
+ // report updatedAt.
+ if (Number.isNaN(updatedAtMs) || Number.isNaN(anchorAtMs)) return true;
return updatedAtMs >= anchorAtMs;
}
@@ -285,11 +289,11 @@ export function threadWokeAt(
* queued turn) are checked first and hold a thread active regardless of any
* override. Past the blockers, the explicit user override (thread.settle /
* thread.unsettle commands, projected into settledOverride + settledAt)
- * wins in both directions. Without one, exactly one selected policy can
- * auto-settle: a merged/closed pull request whose terminal timestamp is the
- * thread's latest user event (see changeRequestAutoSettles), inactivity past
- * the configured window, or never. An open PR blocks the inactivity path.
- * The server
+ * wins in both directions; without one, a thread can auto-settle on a
+ * merged PR or always on a closed PR (both only while the terminal state is
+ * the thread's latest event, see changeRequestAutoSettles), or settles on
+ * inactivity past the window.
+ * An open PR blocks the inactivity path entirely. The server
* un-settles on real activity (user message, session start, approval/
* user-input request), so an override never goes stale silently.
*/
@@ -298,7 +302,7 @@ export function effectiveSettled(
options: {
readonly now: string;
readonly autoSettleAfterDays: number | null;
- readonly autoSettleMode: SidebarAutoSettleMode;
+ readonly autoSettleOnMerge?: boolean;
readonly changeRequest?: ChangeRequestSettleSource | null;
},
): boolean {
@@ -325,14 +329,18 @@ export function effectiveSettled(
// "active" is the explicit keep-active pin: it suppresses auto-settle
// until real activity clears it server-side.
if (shell.settledOverride === "active") return false;
- if (options.autoSettleMode === "never") return false;
- if (options.autoSettleMode === "change-request") {
- return changeRequestAutoSettles(options.changeRequest, { thread: shell });
+ if (
+ changeRequestAutoSettles(options.changeRequest, {
+ autoSettleOnMerge: options.autoSettleOnMerge,
+ thread: shell,
+ })
+ ) {
+ return true;
}
// An open PR is unfinished business regardless of how long the thread has
// been quiet: review can take days, and hiding the thread would bury the
- // work waiting on it. Only an explicit user settle resolves it while the
- // inactivity policy is selected.
+ // work waiting on it. A configured merge, a close, or an explicit user
+ // settle resolves it.
if (options.changeRequest?.state === "open") return false;
if (options.autoSettleAfterDays === null) return false;
diff --git a/packages/contracts/src/settings.test.ts b/packages/contracts/src/settings.test.ts
index e0f170dc2f3..32851e735a3 100644
--- a/packages/contracts/src/settings.test.ts
+++ b/packages/contracts/src/settings.test.ts
@@ -117,11 +117,11 @@ describe("ClientSettings environment identification", () => {
});
describe("ClientSettings sidebar", () => {
- it("defaults to the current sidebar with manual settling", () => {
+ it("defaults to the current sidebar with automatic merge and inactivity settling", () => {
const settings = decodeClientSettings({});
expect(settings.legacySidebarEnabled).toBe(false);
expect(settings.sidebarAutoSettleAfterDays).toBe(3);
- expect(settings.sidebarAutoSettleMode).toBe("never");
+ expect(settings.sidebarAutoSettleOnMerge).toBe(true);
});
it("drops the retired sidebar v2 beta keys, resetting everyone to the default", () => {
@@ -153,27 +153,13 @@ describe("ClientSettings sidebar", () => {
).toBeNull();
});
- it("does not preserve the retired merge switch as a hidden automatic path", () => {
- const decoded = decodeClientSettings({ sidebarAutoSettleOnMerge: true });
- expect(decoded.sidebarAutoSettleMode).toBe("never");
- expect(decoded).not.toHaveProperty("sidebarAutoSettleOnMerge");
- });
-
- it.each(["never", "change-request", "inactivity"] as const)(
- "accepts the %s auto-settle mode",
- (sidebarAutoSettleMode) => {
- expect(decodeClientSettings({ sidebarAutoSettleMode }).sidebarAutoSettleMode).toBe(
- sidebarAutoSettleMode,
- );
- expect(decodeClientSettingsPatch({ sidebarAutoSettleMode }).sidebarAutoSettleMode).toBe(
- sidebarAutoSettleMode,
- );
- },
- );
-
- it("rejects unsupported auto-settle modes", () => {
- expect(() => decodeClientSettings({ sidebarAutoSettleMode: "always" })).toThrow();
- expect(() => decodeClientSettingsPatch({ sidebarAutoSettleMode: "always" })).toThrow();
+ it("allows auto-settle on merge to be disabled", () => {
+ expect(decodeClientSettings({ sidebarAutoSettleOnMerge: false }).sidebarAutoSettleOnMerge).toBe(
+ false,
+ );
+ expect(
+ decodeClientSettingsPatch({ sidebarAutoSettleOnMerge: false }).sidebarAutoSettleOnMerge,
+ ).toBe(false);
});
it.each([-1, 0, 91])("rejects an auto-settle threshold outside 1..90: %s", (value) => {
diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.ts
index f59757859d7..7e670229704 100644
--- a/packages/contracts/src/settings.ts
+++ b/packages/contracts/src/settings.ts
@@ -65,9 +65,6 @@ export const SidebarAutoSettleAfterDays = Schema.Number.check(
);
export type SidebarAutoSettleAfterDays = typeof SidebarAutoSettleAfterDays.Type;
export const DEFAULT_SIDEBAR_AUTO_SETTLE_AFTER_DAYS: SidebarAutoSettleAfterDays = 3;
-export const SidebarAutoSettleMode = Schema.Literals(["never", "change-request", "inactivity"]);
-export type SidebarAutoSettleMode = typeof SidebarAutoSettleMode.Type;
-export const DEFAULT_SIDEBAR_AUTO_SETTLE_MODE: SidebarAutoSettleMode = "never";
export const MIN_GLASS_OPACITY = 40;
export const MAX_GLASS_OPACITY = 100;
export const GlassOpacity = Schema.Int.check(
@@ -238,12 +235,7 @@ export const ClientSettingsSchema = Schema.Struct({
sidebarAutoSettleAfterDays: Schema.NullOr(SidebarAutoSettleAfterDays).pipe(
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_AUTO_SETTLE_AFTER_DAYS)),
),
- // A fresh exclusive policy replaces the old independent inactivity and
- // merge switches. Missing mode means manual-only, so an upgrade cannot
- // preserve one hidden automatic path after the user disabled another.
- sidebarAutoSettleMode: SidebarAutoSettleMode.pipe(
- Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_AUTO_SETTLE_MODE)),
- ),
+ sidebarAutoSettleOnMerge: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
sidebarProjectGroupingMode: SidebarProjectGroupingMode.pipe(
Schema.withDecodingDefault(Effect.succeed(DEFAULT_SIDEBAR_PROJECT_GROUPING_MODE)),
),
@@ -952,7 +944,7 @@ export const ClientSettingsPatch = Schema.Struct({
showSkillsInSlashMenu: Schema.optionalKey(Schema.Boolean),
legacySidebarEnabled: Schema.optionalKey(Schema.Boolean),
sidebarAutoSettleAfterDays: Schema.optionalKey(Schema.NullOr(SidebarAutoSettleAfterDays)),
- sidebarAutoSettleMode: Schema.optionalKey(SidebarAutoSettleMode),
+ sidebarAutoSettleOnMerge: Schema.optionalKey(Schema.Boolean),
sidebarProjectGroupingMode: Schema.optionalKey(SidebarProjectGroupingMode),
sidebarProjectGroupingOverrides: Schema.optionalKey(
Schema.Record(TrimmedNonEmptyString, SidebarProjectGroupingMode),