Repository navigation
fix(web,mobile): bound scheduled tasks no longer offer a model their runs ignore #36628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a1e8fad
03bffc5
26331c4
99cf352
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1188,6 +1188,16 @@ const THREAD_MODE_LABELS: Record<ScheduledTaskThreadMode, string> = { | |
| fresh_session: "One thread, fresh session each run", | ||
| }; | ||
|
|
||
| function useScheduledTaskThread(environmentId: EnvironmentId, threadId: ThreadId | null) { | ||
| const ref = threadId === null ? null : scopeThreadRef(environmentId, threadId); | ||
| const shell = useThreadShell(ref); | ||
| // The shell can omit older settled threads; their family read still carries the row. | ||
| const family = useEnvironmentQuery( | ||
| ref !== null && shell === null ? threadFamilies.familyAtom(environmentId, ref.threadId) : null, | ||
| ); | ||
| return shell ?? family.data?.threads.find((row) => row.id === threadId) ?? null; | ||
| } | ||
|
|
||
| function ScheduledTaskDestination({ | ||
| environmentId, | ||
| projectId, | ||
|
|
@@ -1209,12 +1219,7 @@ function ScheduledTaskDestination({ | |
| const [open, setOpen] = useState(false); | ||
| const [query, setQuery] = useState(""); | ||
| const ref = threadId === null ? null : scopeThreadRef(environmentId, threadId); | ||
| const shell = useThreadShell(ref); | ||
| // The shell can omit older settled threads; their family read still carries the title. | ||
| const family = useEnvironmentQuery( | ||
| ref !== null && shell === null ? threadFamilies.familyAtom(environmentId, ref.threadId) : null, | ||
| ); | ||
| const thread = shell ?? family.data?.threads.find((row) => row.id === threadId); | ||
| const thread = useScheduledTaskThread(environmentId, threadId); | ||
| const currentLabel = | ||
| ref !== null | ||
| ? thread?.title.trim() || `Thread ${ref.threadId}` | ||
|
|
@@ -1428,11 +1433,21 @@ function ScheduledTaskEditorForm({ | |
| const activeInstanceId = | ||
| activeSelection?.instanceId ?? firstInstance?.instanceId ?? ("" as ProviderInstanceId); | ||
| const activeModel = activeSelection?.model ?? ""; | ||
| const boundThread = useScheduledTaskThread( | ||
| environmentId, | ||
| draft.threadId ? (draft.threadId as ThreadId) : null, | ||
| ); | ||
| // Bound runs use the thread's current model, so the locked picker shows that one. | ||
| const shownSelection = draft.threadId | ||
| ? (boundThread?.modelSelection ?? null) | ||
| : { instanceId: activeInstanceId, model: activeModel }; | ||
| const shownInstanceId = shownSelection?.instanceId ?? activeInstanceId; | ||
| const shownModel = shownSelection?.model ?? ""; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not display a default model when the bound thread is unresolved. If the family read is pending or fails without data, Show a loading or unavailable value until the thread's selection is known. Do not use the picker's default-selection fallback for this state.
|
||
| const modelOptionsByInstance = getCustomModelOptionsByInstance( | ||
| settings, | ||
| providers, | ||
| activeInstanceId, | ||
| activeModel, | ||
| shownInstanceId, | ||
| shownModel, | ||
| ); | ||
|
|
||
| const reportFailure = (title: string, error: unknown) => { | ||
|
|
@@ -1777,9 +1792,10 @@ function ScheduledTaskEditorForm({ | |
| <div> | ||
| <ProviderModelPicker | ||
| environmentId={environmentId} | ||
| disabled={saving || !connected} | ||
| activeInstanceId={activeInstanceId} | ||
| model={activeModel} | ||
| // The saved selection only seeds new threads; bound runs ignore it. | ||
| disabled={saving || !connected || draft.threadId !== ""} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Explain the model used for fresh sessions. For a bound task in
|
||
| activeInstanceId={shownInstanceId} | ||
| model={shownModel} | ||
| lockedProvider={null} | ||
| instanceEntries={instanceEntries} | ||
| modelOptionsByInstance={modelOptionsByInstance} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.