@devries-cameron20 / t3code-1 / commits / e26e21c06b
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web,mobile): bound scheduled tasks no longer offer a model their runs ignore (#36628)

Julius Marminge committed Nov 14, 2026 at 05:17 UTC e26e21c06b03fc072cb66244902cedf629307a1a
4 files changed +76 -23
apps/mobile/src/features/settings/SettingsScheduledTasksRouteScreen.tsx
+16 -5
@@ -83,7 +83,11 @@ import {
83 type ScheduledTaskDraft as Draft,
84 } from "./scheduledTaskDraft";
85 import { settingsTargetsForProject } from "./settings-environment-filter.logic";
86 -import { useScheduledTaskDestinationLabel, useScheduledTaskEditor } from "./scheduled-task-editor";
86 +import {
87 + useScheduledTaskDestinationLabel,
88 + useScheduledTaskEditor,
89 + useScheduledTaskThread,
90 +} from "./scheduled-task-editor";
91 import {
92 discardScheduledTaskEditor,
93 markScheduledTaskEditorSaved,
@@ -693,6 +697,10 @@ function TaskForm({
697 .sort((left, right) => Number(right.pinnedAt != null) - Number(left.pinnedAt != null));
698 const config = useEnvironmentServerConfig(environmentId);
699 const destinationLabel = useScheduledTaskDestinationLabel(environmentId, draft.threadId);
700 + const boundThread = useScheduledTaskThread(environmentId, draft.threadId);
701 + // Bound runs use the thread's current model, so the locked row shows that one.
702 + const shownSelection =
703 + draft.threadId === null ? draft.modelSelection : (boundThread?.modelSelection ?? null);
704 const modelOptions = buildModelOptions(config, null, undefined, draft.projectId);
705 // Existing webhook tasks keep the option so they can still switch to a timer.
706 const webhookDenial = managedCapabilityDenial(config?.managedPolicy, "webhookTasks");
@@ -929,14 +937,17 @@ function TaskForm({
937 value={
938 modelOptions.find(
939 (option) =>
932 - option.selection.instanceId === draft.modelSelection?.instanceId &&
933 - option.selection.model === draft.modelSelection?.model,
940 + option.selection.instanceId === shownSelection?.instanceId &&
941 + option.selection.model === shownSelection?.model,
942 )?.label ??
935 - draft.modelSelection?.model ??
943 + shownSelection?.model ??
944 (modelOptions.length ? "Choose model" : "No models available")
945 }
946 onPress={() => navigation.navigate("SettingsScheduledTaskModel")}
939 - disabled={saving || dictationPending || environmentUnavailable}
947 + // The saved selection only seeds new threads; bound runs ignore it.
948 + disabled={
949 + saving || dictationPending || environmentUnavailable || draft.threadId !== null
950 + }
951 />
952 </SettingsSection>
953
apps/mobile/src/features/settings/scheduled-task-editor.tsx
+13 -6
@@ -21,22 +21,29 @@ import {
21
22 export const NEW_THREAD_DESTINATION_LABEL = "New thread each run";
23
24 -export function useScheduledTaskDestinationLabel(
24 +export function useScheduledTaskThread(
25 environmentId: EnvironmentId | null,
26 threadId: ThreadId | null,
27 -): string {
27 +) {
28 const ref =
29 environmentId === null || threadId === null ? null : scopeThreadRef(environmentId, threadId);
30 const shell = useThreadShell(ref);
31 - // The shell can omit older settled threads; their family read still carries the title.
31 + // The shell can omit older settled threads; their family read still carries the row.
32 const family = useEnvironmentQuery(
33 ref !== null && shell === null
34 ? threadFamilies.familyAtom(ref.environmentId, ref.threadId)
35 : null,
36 );
37 - const thread = shell ?? family.data?.threads.find((row) => row.id === threadId);
38 - if (ref === null) return NEW_THREAD_DESTINATION_LABEL;
39 - return thread?.title.trim() || `Thread ${ref.threadId}`;
37 + return shell ?? family.data?.threads.find((row) => row.id === threadId) ?? null;
38 +}
39 +
40 +export function useScheduledTaskDestinationLabel(
41 + environmentId: EnvironmentId | null,
42 + threadId: ThreadId | null,
43 +): string {
44 + const thread = useScheduledTaskThread(environmentId, threadId);
45 + if (environmentId === null || threadId === null) return NEW_THREAD_DESTINATION_LABEL;
46 + return thread?.title.trim() || `Thread ${threadId}`;
47 }
48
49 /** The form draft lives in an atom, so it survives while its native picker routes are on top. */
apps/web/src/components/settings/ScheduledTasksSettings.browser.test.tsx
+20 -1
@@ -45,7 +45,13 @@ const task: ScheduledTask = {
45 // Stands in for the thread family read the editor makes when the shell lacks the bound thread.
46 const threadFamilyRead = {
47 snapshotSequence: 1,
48 - threads: [{ id: task.threadId, title: "Fix login bug" }],
48 + threads: [
49 + {
50 + id: task.threadId,
51 + title: "Fix login bug",
52 + modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.5" },
53 + },
54 + ],
55 };
56
57 const state = vi.hoisted(() => ({
@@ -244,6 +250,19 @@ describe("ScheduledTasksSettings", () => {
250 await expect.element(name).toHaveValue("Review stale issues");
251 });
252
253 + it("offers no model choice for a task bound to a thread, whose runs use the thread's model", async () => {
254 + setup();
255 + await using _screen = await render(<ScheduledTasksSettings taskId={task.id} />);
256 + await expect.element(page.getByRole("dialog").getByText("Fix login bug")).toBeVisible();
257 + const enabledPicker = document.querySelector(
258 + '[role="dialog"] [data-chat-provider-model-picker]:not(:disabled)',
259 + );
260 + expect(enabledPicker).toBeNull();
261 + await expect
262 + .element(page.getByRole("dialog").getByRole("button", { name: "gpt-5.5", exact: true }))
263 + .toBeDisabled();
264 + });
265 +
266 it("keeps an editor the user opened when the linked task loads later", async () => {
267 setup();
268 state.tasksLoaded = false;
apps/web/src/components/settings/ScheduledTasksSettings.tsx
+27 -11
@@ -1188,6 +1188,16 @@ const THREAD_MODE_LABELS: Record<ScheduledTaskThreadMode, string> = {
1188 fresh_session: "One thread, fresh session each run",
1189 };
1190
1191 +function useScheduledTaskThread(environmentId: EnvironmentId, threadId: ThreadId | null) {
1192 + const ref = threadId === null ? null : scopeThreadRef(environmentId, threadId);
1193 + const shell = useThreadShell(ref);
1194 + // The shell can omit older settled threads; their family read still carries the row.
1195 + const family = useEnvironmentQuery(
1196 + ref !== null && shell === null ? threadFamilies.familyAtom(environmentId, ref.threadId) : null,
1197 + );
1198 + return shell ?? family.data?.threads.find((row) => row.id === threadId) ?? null;
1199 +}
1200 +
1201 function ScheduledTaskDestination({
1202 environmentId,
1203 projectId,
@@ -1209,12 +1219,7 @@ function ScheduledTaskDestination({
1219 const [open, setOpen] = useState(false);
1220 const [query, setQuery] = useState("");
1221 const ref = threadId === null ? null : scopeThreadRef(environmentId, threadId);
1212 - const shell = useThreadShell(ref);
1213 - // The shell can omit older settled threads; their family read still carries the title.
1214 - const family = useEnvironmentQuery(
1215 - ref !== null && shell === null ? threadFamilies.familyAtom(environmentId, ref.threadId) : null,
1216 - );
1217 - const thread = shell ?? family.data?.threads.find((row) => row.id === threadId);
1222 + const thread = useScheduledTaskThread(environmentId, threadId);
1223 const currentLabel =
1224 ref !== null
1225 ? thread?.title.trim() || `Thread ${ref.threadId}`
@@ -1428,11 +1433,21 @@ function ScheduledTaskEditorForm({
1433 const activeInstanceId =
1434 activeSelection?.instanceId ?? firstInstance?.instanceId ?? ("" as ProviderInstanceId);
1435 const activeModel = activeSelection?.model ?? "";
1436 + const boundThread = useScheduledTaskThread(
1437 + environmentId,
1438 + draft.threadId ? (draft.threadId as ThreadId) : null,
1439 + );
1440 + // Bound runs use the thread's current model, so the locked picker shows that one.
1441 + const shownSelection = draft.threadId
1442 + ? (boundThread?.modelSelection ?? null)
1443 + : { instanceId: activeInstanceId, model: activeModel };
1444 + const shownInstanceId = shownSelection?.instanceId ?? activeInstanceId;
1445 + const shownModel = shownSelection?.model ?? "";
1446 const modelOptionsByInstance = getCustomModelOptionsByInstance(
1447 settings,
1448 providers,
1434 - activeInstanceId,
1435 - activeModel,
1449 + shownInstanceId,
1450 + shownModel,
1451 );
1452
1453 const reportFailure = (title: string, error: unknown) => {
@@ -1777,9 +1792,10 @@ function ScheduledTaskEditorForm({
1792 <div>
1793 <ProviderModelPicker
1794 environmentId={environmentId}
1780 - disabled={saving || !connected}
1781 - activeInstanceId={activeInstanceId}
1782 - model={activeModel}
1795 + // The saved selection only seeds new threads; bound runs ignore it.
1796 + disabled={saving || !connected || draft.threadId !== ""}
1797 + activeInstanceId={shownInstanceId}
1798 + model={shownModel}
1799 lockedProvider={null}
1800 instanceEntries={instanceEntries}
1801 modelOptionsByInstance={modelOptionsByInstance}