Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
d94be84
feat(web): add provider model bulk toggle (#10947)
UtkarshUsername Sep 9, 2026
0fdaa19
feat(web): open Usage on the Limits tab by default (#11261)
juliusmarminge Sep 11, 2026
2bf65cc
feat(settings): add per-project overrides for scopable server setting…
juliusmarminge Sep 11, 2026
a7a92f1
feat(web): pick settings environment and project as two selects (#10636)
juliusmarminge Sep 11, 2026
2f1ad6f
feat(settings): edit any scopable setting as a project override (#10639)
juliusmarminge Sep 11, 2026
ae004bf
feat(web): mark projects on another machine in project pickers (#11323)
maria-rcks Sep 11, 2026
8453a08
fix(models): default to astra medium and fable 5.1 medium (#11347)
maria-rcks Sep 12, 2026
4009cd1
fix(web): align provider settings with shared settings rows (#10571)
maria-rcks Sep 12, 2026
97ce022
feat(settings): configure default permissions for new threads (#11346)
maria-rcks Sep 12, 2026
9a36e4e
fix(settings): preserve legacy edits and Pylon scoped behavior
rynfar Sep 12, 2026
95403e6
fix(settings): complete scoped settings validation cleanup
rynfar Sep 12, 2026
d22fa3b
fix(settings): require project lookup before restart continuation
rynfar Sep 12, 2026
3ae20bc
fix(settings): keep unavailable project preferences resettable
rynfar Sep 12, 2026
0ec9e6e
test(settings): cover scoped device access and header targeting
rynfar Sep 12, 2026
ca9ae83
fix(settings): honor project device access throughout setup and tools
rynfar Sep 12, 2026
d1409a3
test(settings): retain pull-request capability with scoped device access
rynfar Sep 12, 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
74 changes: 45 additions & 29 deletions apps/mobile/src/features/settings/SettingsRouteScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { ServerSettings } from "@t3tools/contracts";
import { useAuth, useUser } from "@clerk/expo";
import { useAtomSet, useAtomValue } from "@effect/atom-react";
import Constants from "expo-constants";
Expand Down Expand Up @@ -43,13 +44,10 @@ import {
DEFAULT_SERVER_SETTINGS,
MAX_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
MIN_SIDEBAR_AUTO_SETTLE_AFTER_DAYS,
type ServerSettingsPatch,
} from "@t3tools/contracts";
import {
filterSharedServerPatch,
findSharedSettingsMismatches,
supportsSharedSettingsSync,
pickSharedServerSettings,
} from "@t3tools/client-runtime/state/shared-settings";
import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled";
import {
Expand All @@ -67,6 +65,7 @@ import {
resolveAgentAwarenessSignInMessage,
resolveAgentAwarenessSubtitle,
} 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 @@ -622,6 +621,9 @@ const AUTO_SETTLE_DEFAULT_DAYS = DEFAULT_SERVER_SETTINGS.sidebarAutoSettleAfterD
* has no primary environment, so the first eligible environment that
* supports restart continuation when available is the reference value. Edits fan out to every eligible
* environment, 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 SharedThreadSettingsRows() {
const { environments } = useEnvironments();
Expand All @@ -646,7 +648,9 @@ function SharedThreadSettingsRows() {
return null;
}

const writeToAll = (patch: ServerSettingsPatch) => {
const writeToAll = (
patch: Partial<AutoSettleSettings & Pick<ServerSettings, "continueThreadsAfterServerUpdate">>,
) => {
for (const environment of syncTargets) {
const supportedPatch = filterSharedServerPatch(
patch,
Expand All @@ -661,20 +665,22 @@ function SharedThreadSettingsRows() {
}
};

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 continuationMismatches = syncTargets.filter(
(environment) =>
environment.serverConfig?.environment.capabilities.threadRestartContinuation === true &&
environment.serverConfig.settings.continueThreadsAfterServerUpdate !==
referenceSettings.continueThreadsAfterServerUpdate,
);
const commitDays = () => {
const draft = (daysDraft ?? "").trim();
setDaysDraft(null);
Expand Down Expand Up @@ -735,38 +741,48 @@ function SharedThreadSettingsRows() {
{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}
{continuationMismatches.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">Restart continuation defaults differ</Text>
<Text className="text-sm text-foreground-muted">
{continuationMismatches.map((environment) => environment.label).join(", ")}
</Text>
</View>
<Pressable
accessibilityRole="button"
onPress={() =>
writeToAll({
continueThreadsAfterServerUpdate:
referenceSettings.continueThreadsAfterServerUpdate,
})
}
className="rounded-full bg-subtle px-4 py-2 active:opacity-70"
>
<Text className="text-base font-t3-medium text-foreground">Apply restart 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 };
}
43 changes: 31 additions & 12 deletions apps/mobile/src/features/threads/new-task-flow-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ import {
CommandId,
DEFAULT_PROVIDER_INTERACTION_MODE,
DEFAULT_RUNTIME_MODE,
DEFAULT_SERVER_SETTINGS,
MessageId,
T3_PROJECT_FILE_NAME,
ThreadId,
} from "@t3tools/contracts";
import {
projectDefaultModelPreference,
resolveProjectSettings,
} from "@t3tools/shared/projectSettings";
import { parseT3ProjectFile } from "@t3tools/shared/t3ProjectFile";
import {
isDefaultThreadEnvModeSettled,
Expand Down Expand Up @@ -429,17 +434,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 @@ -450,10 +470,11 @@ 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;
const draftRuntimeMode = selectedProjectDraft.runtimeMode ?? DEFAULT_RUNTIME_MODE;
draftStartFromOrigin ?? projectSettings.settings.newWorktreesStartFromOrigin;
const defaultRuntimeMode = editingPendingTask
? (editingPendingTask.runtimeMode ?? DEFAULT_RUNTIME_MODE)
: projectSettings.settings.defaultRuntimeMode;
const draftRuntimeMode = selectedProjectDraft.runtimeMode ?? defaultRuntimeMode;
const draftInteractionMode =
selectedProjectDraft.interactionMode ?? DEFAULT_PROVIDER_INTERACTION_MODE;

Expand All @@ -463,10 +484,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
// server status for remediation and require a new pick instead of silently
// switching providers. Project and sticky defaults also reject legacy models.
const storedDraftModelSelection = selectedProjectDraft.modelSelection ?? null;
const storedProjectDefaultModelSelection =
selectedProject?.defaultModelSelection ??
selectedEnvironmentServerConfig?.settings.defaultModelSelection ??
null;
const storedProjectDefaultModelSelection = projectDefaultModelPreference(projectSettings);
const storedStickyModelSelection = useStickyComposerModelSelection();
const unavailablePreferredProvider = resolveNewTaskUnavailableProvider(
selectedEnvironmentServerConfig,
Expand Down Expand Up @@ -998,7 +1016,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
runtimeMode: resolveModelSelectionRuntimeMode(
selectedEnvironmentServerConfig,
draftModelSelection,
draft.runtimeMode ?? DEFAULT_RUNTIME_MODE,
draft.runtimeMode ?? defaultRuntimeMode,
),
...(preservedDeliveryHold === undefined ? {} : { deliveryHold: preservedDeliveryHold }),
interactionMode:
Expand Down Expand Up @@ -1040,6 +1058,7 @@ export function NewTaskFlowProvider(props: React.PropsWithChildren) {
};
},
[
defaultRuntimeMode,
editingPendingProject,
editingPendingTask,
selectedEnvironmentServerConfig,
Expand Down
4 changes: 3 additions & 1 deletion apps/mobile/src/features/usage/UsageRouteScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ const CHART_HEIGHT = 180;
export function UsageRouteScreen() {
const navigation = useNavigation();
const insets = useSafeAreaInsets();
const [tab, setTab] = useState<UsageTab>("usage");
// Limits first: remaining quota and reset time are what most people open
// the screen for.
const [tab, setTab] = useState<UsageTab>("limits");
const [windowSelection, setWindowSelection] = useState(() => ({
days: 30,
window: makeWindow(30),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import { ThreadDeletionReactor } from "../src/orchestration/Services/ThreadDelet
import * as ThreadSettlementReactor from "../src/orchestration/ThreadSettlementReactor.ts";
import * as PullRequestSyncReactor from "../src/orchestration/PullRequestSyncReactor.ts";
import * as ThreadPullRequestReactor from "../src/orchestration/ThreadPullRequestReactor.ts";
import * as ProjectSettingsReactor from "../src/orchestration/ProjectSettingsReactor.ts";
import { OrchestrationReactor } from "../src/orchestration/Services/OrchestrationReactor.ts";
import { ProjectionSnapshotQuery } from "../src/orchestration/Services/ProjectionSnapshotQuery.ts";
import {
Expand Down Expand Up @@ -406,6 +407,12 @@ export const makeOrchestrationIntegrationHarness = (
requestSync: () => Effect.void,
}),
),
Layer.provideMerge(
Layer.succeed(ProjectSettingsReactor.ProjectSettingsReactor, {
start: () => Effect.void,
drain: Effect.void,
}),
),
Layer.provideMerge(
Layer.succeed(AgentAwarenessRelay.AgentAwarenessRelay, {
publishThread: () => Effect.void,
Expand Down
Loading
Loading