Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
02c138d
feat(settings): keep scope across pages and isolate environment edits
juliusmarminge Sep 8, 2026
87b1182
fix(settings): remove obsolete sync paths and isolate settings tests
juliusmarminge Sep 8, 2026
e6665bb
fix(web): use shared alerts for settings scope guidance
juliusmarminge Sep 8, 2026
d8d32b9
docs(settings): clarify target ownership and auto-settle edits
juliusmarminge Sep 8, 2026
2811516
fix(settings): disambiguate duplicate environment choices
juliusmarminge Sep 8, 2026
4fd2014
fix(settings): require an edit before applying bulk instructions
juliusmarminge Sep 8, 2026
0f07ef9
fix(settings): keep the current category when changing scope
juliusmarminge Sep 8, 2026
2c0a9fa
fix(settings): allow resetting mixed writing styles
juliusmarminge Sep 8, 2026
9afd8d1
test(settings): exercise the production legacy scope validator
juliusmarminge Sep 8, 2026
5353bc1
fix(settings): reset mixed template preferences
juliusmarminge Sep 8, 2026
0179fc3
feat(settings): organize project overrides by category and show inher…
juliusmarminge Sep 8, 2026
69554f3
fix(settings): guard action editor saves and finish scope cleanup
juliusmarminge Sep 8, 2026
816cb53
fix(web): keep action save cleanup compiler-compatible
juliusmarminge Sep 8, 2026
b0b612c
fix(settings): handle unavailable sources and multiline targets
juliusmarminge Sep 8, 2026
c1b5f90
fix(settings): route capability-specific search to supported targets
juliusmarminge Sep 8, 2026
a94a52c
fix(settings): label checkouts with unavailable environment names
juliusmarminge Sep 8, 2026
2c4fcee
fix(settings): preserve category during checkout navigation
juliusmarminge Sep 8, 2026
4f007a3
fix(web): pass the project record to ProjectFavicon in project overview
juliusmarminge Sep 11, 2026
67c197e
refactor(web): drop sidebar page sections superseded on main
juliusmarminge Sep 11, 2026
74a44ac
feat(settings): edit any scopable setting as a project override
juliusmarminge Sep 11, 2026
c36fb95
fix(settings): fan every environment setting out and show the resolut…
juliusmarminge Sep 11, 2026
e426899
feat(settings): pick the scope from the breadcrumb and mark inheritan…
juliusmarminge Sep 11, 2026
59c6f96
fix(settings): name the environment, not the checkout path, in the re…
juliusmarminge Sep 11, 2026
00866e4
feat(settings): show the resolution chain icon at every scope
juliusmarminge Sep 11, 2026
154e0b8
feat(settings): show mixed values in the control and drop the single-…
juliusmarminge Sep 11, 2026
cac0be4
refactor(settings): fold Actions into the Project page and move merge…
juliusmarminge Sep 11, 2026
914673f
fix(settings): show machine-local sections for the representative env…
juliusmarminge Sep 11, 2026
d31656d
design(settings): tighten the resolution chain popover and keep the p…
juliusmarminge Sep 11, 2026
9033ffd
feat(settings): surface and reset project overrides from the environm…
juliusmarminge Sep 11, 2026
2ef5e0e
fix(settings): show a checkout link's environment in the breadcrumb
juliusmarminge Sep 11, 2026
df72924
fix(settings): close the audit findings on the override UI layer
juliusmarminge Sep 11, 2026
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
52 changes: 15 additions & 37 deletions apps/mobile/src/features/settings/SettingsRouteScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,8 @@ import {
DEFAULT_SERVER_SETTINGS,
MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
type ServerSettingsPatch,
} from "@t3tools/contracts";
import {
filterSharedServerPatch,
findSharedSettingsMismatches,
pickSharedServerSettings,
supportsSharedSettingsSync,
} from "@t3tools/client-runtime/state/shared-settings";
import { supportsSharedSettingsSync } from "@t3tools/client-runtime/state/shared-settings";
import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled";
import {
type AppUpdateCheckState,
Expand All @@ -61,6 +55,7 @@ import { SettingsRow } from "./components/SettingsRow";
import { SettingsSection } from "./components/SettingsSection";
import { SettingsSwitchRow } from "./components/SettingsSwitchRow";
import { resolveAgentAwarenessPlatformPresentation } from "./SettingsRouteScreen.logic";
import { planAutoSettleSettingsSync, type AutoSettleSettings } from "./autoSettleSettingsSync";

type NotificationStatus = "checking" | "enabled" | "disabled" | "unsupported";
type LiveActivityStatus = "checking" | "enabled" | "disabled" | "signed-out" | "linking";
Expand Down Expand Up @@ -588,10 +583,9 @@ function GeneralSettingsSection() {
const AUTO_SETTLE_DEFAULT_DAYS = DEFAULT_SERVER_SETTINGS.sidebarAutoSettleAfterDays ?? 3;

/**
* Auto-settlement is a user preference that every server has to hold. Mobile
* has no primary environment, so the first eligible sync target provides the
* reference value. Edits fan out to every eligible target, and a mismatch row
* lets the user push the reference out.
* Mobile edits auto-settle defaults across connected, capable environments.
* The first target supplies the displayed values. Applying them leaves each
* environment's other defaults and overrides intact.
*/
function AutoSettleSettingsRows() {
const { environments } = useEnvironments();
Expand All @@ -610,24 +604,20 @@ function AutoSettleSettingsRows() {
return null;
}

const writeToAll = (patch: ServerSettingsPatch) => {
const writeToAll = (patch: Partial<AutoSettleSettings>) => {
for (const environment of syncTargets) {
void updateSettings({ environmentId: environment.environmentId, input: { patch } });
}
};

const mismatches = findSharedSettingsMismatches({
primaryEnvironmentId: reference.environmentId,
primarySettings: referenceSettings,
primaryCapabilities: reference.serverConfig?.environment.capabilities,
environments: environments.map((environment) => ({
const { patch: autoSettlePatch, mismatches } = planAutoSettleSettingsSync(
{ environmentId: reference.environmentId, settings: referenceSettings },
syncTargets.map((environment) => ({
environmentId: environment.environmentId,
label: environment.label,
syncEligible: supportsSharedSettingsSync(environment),
settings: environment.serverConfig?.settings ?? null,
capabilities: environment.serverConfig?.environment.capabilities,
})),
});
);

const afterDays = referenceSettings.sidebarAutoSettleAfterDays;
const commitDays = () => {
Expand Down Expand Up @@ -681,38 +671,26 @@ function AutoSettleSettingsRows() {
{mismatches.length > 0 ? (
<View className="flex-row items-center gap-4 border-t border-border-subtle p-4">
<View className="min-w-0 flex-1">
<Text className="text-lg text-foreground">Settings differ</Text>
<Text className="text-lg text-foreground">Auto-settle defaults differ</Text>
<Text className="text-sm text-foreground-muted">
{mismatches.map((mismatch) => mismatch.label).join(", ")}
</Text>
</View>
<Pressable
accessibilityRole="button"
onPress={() => {
const patch = pickSharedServerSettings(
referenceSettings,
reference.serverConfig?.environment.capabilities,
);
for (const mismatch of mismatches) {
const target = environments.find(
(candidate) => candidate.environmentId === mismatch.environmentId,
);
void updateSettings({
environmentId: mismatch.environmentId,
input: {
patch: filterSharedServerPatch(
patch,
target?.serverConfig?.environment.capabilities,
target?.serverConfig?.settings,
referenceSettings,
),
},
input: { patch: autoSettlePatch },
});
}
}}
className="rounded-full bg-subtle px-4 py-2 active:opacity-70"
>
<Text className="text-base font-t3-medium text-foreground">Apply to all</Text>
<Text className="text-base font-t3-medium text-foreground">
Apply auto-settle defaults
</Text>
</Pressable>
</View>
) : null}
Expand Down
78 changes: 78 additions & 0 deletions apps/mobile/src/features/settings/autoSettleSettingsSync.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { DEFAULT_SERVER_SETTINGS, EnvironmentId } from "@t3tools/contracts";
import { describe, expect, it } from "vite-plus/test";

import { planAutoSettleSettingsSync } from "./autoSettleSettingsSync";

const reference = {
environmentId: EnvironmentId.make("reference"),
settings: {
...DEFAULT_SERVER_SETTINGS,
sidebarAutoSettleAfterDays: 7,
sidebarAutoSettleOnMerge: true,
newWorktreesStartFromOrigin: false,
continueThreadsAfterServerUpdate: false,
},
};

describe("auto-settle settings sync", () => {
it("ignores differences in independently configured environment settings", () => {
const target = {
environmentId: EnvironmentId.make("remote"),
label: "Remote",
settings: {
...reference.settings,
newWorktreesStartFromOrigin: true,
continueThreadsAfterServerUpdate: true,
sourceControlWritingStyle: {
...reference.settings.sourceControlWritingStyle,
customInstructions: "Keep this environment's writing instructions.",
},
},
};

const plan = planAutoSettleSettingsSync(reference, [target]);

expect(plan.mismatches).toEqual([]);
expect(plan.patch).toEqual({
sidebarAutoSettleAfterDays: 7,
sidebarAutoSettleOnMerge: true,
});
});

it("applies only auto-settle defaults when another environment differs", () => {
const target = {
environmentId: EnvironmentId.make("remote"),
label: "Remote",
settings: {
...reference.settings,
sidebarAutoSettleAfterDays: null,
sidebarAutoSettleOnMerge: false,
newWorktreesStartFromOrigin: true,
continueThreadsAfterServerUpdate: true,
sourceControlWritingStyle: {
...reference.settings.sourceControlWritingStyle,
customInstructions: "Preserve these instructions.",
},
},
};

const plan = planAutoSettleSettingsSync(reference, [target]);
const updated = { ...target.settings, ...plan.patch };

expect(plan.mismatches).toEqual([target]);
expect(updated.sidebarAutoSettleAfterDays).toBe(7);
expect(updated.sidebarAutoSettleOnMerge).toBe(true);
expect(updated.newWorktreesStartFromOrigin).toBe(true);
expect(updated.continueThreadsAfterServerUpdate).toBe(true);
expect(updated.sourceControlWritingStyle).toEqual(target.settings.sourceControlWritingStyle);
});

it("does not compare the reference or a target without loaded settings", () => {
const plan = planAutoSettleSettingsSync(reference, [
{ ...reference, label: "Reference" },
{ environmentId: EnvironmentId.make("loading"), label: "Loading", settings: null },
]);

expect(plan.mismatches).toEqual([]);
});
});
31 changes: 31 additions & 0 deletions apps/mobile/src/features/settings/autoSettleSettingsSync.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { EnvironmentId, ServerSettings } from "@t3tools/contracts";

export type AutoSettleSettings = Pick<
ServerSettings,
"sidebarAutoSettleAfterDays" | "sidebarAutoSettleOnMerge"
>;

interface AutoSettleSyncTarget {
readonly environmentId: EnvironmentId;
readonly label: string;
readonly settings: AutoSettleSettings | null;
}

/** Receives connected, capable targets. Applying these defaults must preserve other settings. */
export function planAutoSettleSettingsSync(
reference: { readonly environmentId: EnvironmentId; readonly settings: AutoSettleSettings },
targets: readonly AutoSettleSyncTarget[],
) {
const patch: AutoSettleSettings = {
sidebarAutoSettleAfterDays: reference.settings.sidebarAutoSettleAfterDays,
sidebarAutoSettleOnMerge: reference.settings.sidebarAutoSettleOnMerge,
};
const mismatches = targets.filter(
(target) =>
target.environmentId !== reference.environmentId &&
target.settings !== null &&
(target.settings.sidebarAutoSettleAfterDays !== patch.sidebarAutoSettleAfterDays ||
target.settings.sidebarAutoSettleOnMerge !== patch.sidebarAutoSettleOnMerge),
);
return { patch, mismatches };
}
31 changes: 22 additions & 9 deletions apps/mobile/src/features/threads/new-task-flow-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import {
CommandId,
DEFAULT_PROVIDER_INTERACTION_MODE,
DEFAULT_RUNTIME_MODE,
DEFAULT_SERVER_SETTINGS,
MessageId,
T3_PROJECT_FILE_NAME,
ThreadId,
} from "@t3tools/contracts";
import { resolveProjectSettings } from "@t3tools/shared/projectSettings";
import { parseT3ProjectFile } from "@t3tools/shared/t3ProjectFile";
import {
isDefaultThreadEnvModeSettled,
Expand Down Expand Up @@ -428,17 +430,32 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
if (t3ProjectFileData === null || t3ProjectFileData.truncated) return null;
return parseT3ProjectFile(t3ProjectFileData.contents)?.defaultThreadEnvMode ?? null;
}, [t3ProjectFileData]);
// Environment settings with the project's overrides applied; the
// aggregate's own legacy fields still count until the server folds them.
const projectSettings = useMemo(
() =>
resolveProjectSettings(
selectedEnvironmentServerConfig?.settings ?? DEFAULT_SERVER_SETTINGS,
selectedProject?.id ?? null,
selectedProject,
),
[selectedEnvironmentServerConfig?.settings, selectedProject],
);
const projectThreadEnvMode =
projectSettings.sources.defaultThreadEnvMode === "project"
? projectSettings.settings.defaultThreadEnvMode
: undefined;
const defaultWorkspaceMode: WorkspaceMode = resolveDefaultThreadEnvMode({
projectSetting: selectedProject?.defaultThreadEnvMode,
projectSetting: projectThreadEnvMode,
projectFile: t3ProjectFileDefaultMode,
globalDefault: selectedEnvironmentServerConfig?.settings.defaultThreadEnvMode ?? "local",
globalDefault: projectSettings.settings.defaultThreadEnvMode,
});
// While unsettled the resolved default is provisional. Nothing may write
// it into the draft during that window (the auto-branch effect does), or
// the frozen interim value beats the t3.json default once it loads.
const defaultWorkspaceModeSettled = isDefaultThreadEnvModeSettled({
explicitMode: selectedProjectDraft.workspaceSelection?.mode,
projectSetting: selectedProject?.defaultThreadEnvMode,
projectSetting: projectThreadEnvMode,
projectFilePending: t3ProjectFileQuery.isPending,
});
const workspaceMode = selectedProjectDraft.workspaceSelection?.mode ?? defaultWorkspaceMode;
Expand All @@ -449,9 +466,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
// value keeps tracking the server setting when the config loads late.
const draftStartFromOrigin = selectedProjectDraft.workspaceSelection?.startFromOrigin;
const startFromOrigin =
draftStartFromOrigin ??
selectedEnvironmentServerConfig?.settings.newWorktreesStartFromOrigin ??
true;
draftStartFromOrigin ?? projectSettings.settings.newWorktreesStartFromOrigin;
const runtimeMode = selectedProjectDraft.runtimeMode ?? DEFAULT_RUNTIME_MODE;

// Antigravity keeps unavailable selections so sign-out or a catalog change
Expand All @@ -463,9 +478,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
);
const projectDefaultModelSelection = resolveDefaultableModelSelection(
selectedEnvironmentServerConfig,
selectedProject?.defaultModelSelection ??
selectedEnvironmentServerConfig?.settings.defaultModelSelection ??
null,
projectSettings.settings.defaultModelSelection,
);
const storedStickyModelSelection = useStickyComposerModelSelection();
const stickyModelSelection = resolveDefaultableModelSelection(
Expand Down
Loading
Loading