feat: add per-task LLM provider selection for scheduled tasks#450
Merged
feat: add per-task LLM provider selection for scheduled tasks#450
Conversation
Allow users to choose which AI provider a scheduled task runs with, using the same ChatProviderSelector component from the new-tab page. Falls back to the global default provider when none is selected or if the selected provider has been deleted.
Contributor
Greptile SummaryThis PR adds per-task LLM provider selection for scheduled tasks, allowing users to choose which AI provider a task runs with instead of always using the global default. The implementation is clean and well-structured, touching all the right layers: type definitions, UI (create/edit dialog + task card display), execution logic (provider resolution with fallback), GraphQL schema, and backend sync.
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User creates/edits task] --> B[NewScheduledTaskDialog]
B --> C{Provider selected?}
C -->|Yes| D[Save providerId to ScheduledJob]
C -->|No| E[providerId = undefined]
D --> F[Sync to backend as llmProviderId]
E --> F
F --> G[Chrome alarm triggers job]
G --> H[scheduledJobRuns.executeScheduledJob]
H --> I[getChatServerResponse with providerId]
I --> J[resolveProvider]
J --> K{providerId set & found?}
K -->|Yes| L[Use task-specific provider]
K -->|No| M{Global default exists?}
M -->|Yes| N[Use global default provider]
M -->|No| O[Use built-in BrowserOS provider]
L --> P[Send chat request to agent server]
N --> P
O --> P
Prompt To Fix All With AIThis is a comment left during a code review.
Path: packages/browseros-agent/apps/agent/entrypoints/app/scheduled-tasks/NewScheduledTaskDialog.tsx
Line: 257-260
Comment:
**Redundant type cast**
`resolvedProvider.type` is already `ProviderType` (the `Provider` interface defines `type: ProviderType`), so the `as ProviderType` cast is unnecessary.
```suggestion
<ProviderIcon
type={resolvedProvider.type}
size={16}
/>
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: packages/browseros-agent/apps/agent/lib/schedules/getChatServerResponse.ts
Line: 80-89
Comment:
**Redundant `providersStorage` read on fallback**
When `providerId` is provided but doesn't match any configured provider (e.g., provider was deleted), `resolveProvider` reads `providersStorage` at line 84, finds no match, then calls `getDefaultProvider()` which reads `providersStorage` again at line 71. Consider reusing the already-fetched providers list to avoid the duplicate storage read:
```
const resolveProvider = async (
providerId?: string,
): Promise<LlmProviderConfig> => {
const providers = await providersStorage.getValue()
if (providerId) {
const match = providers?.find((p) => p.id === providerId)
if (match) return match
}
if (!providers?.length) return createDefaultBrowserOSProvider()
const defaultProviderId = await defaultProviderIdStorage.getValue()
return providers.find((p) => p.id === defaultProviderId) ?? providers[0] ?? createDefaultBrowserOSProvider()
}
```
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 9ec90fb |
DaniAkash
requested changes
Mar 16, 2026
DaniAkash
approved these changes
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ChatProviderSelectorcomponent from the new-tab chat pagellmProviderIdfield syncs to the GraphQL backendDesign
Adds an optional
providerIdfield toScheduledJobthat references an existingLlmProviderConfigby UUID. At execution time,getChatServerResponseresolves the task-specific provider from storage, falling back to the global default. The GraphQL schema, sync logic, and UI are updated to support the new field. Fully backward compatible — existing tasks without a provider continue using the default.Files changed (8)
scheduleTypes.ts— AddedproviderIdfield toScheduledJobNewScheduledTaskDialog.tsx— Provider selector UI in create/edit dialoggetChatServerResponse.ts— Provider resolution with fallbackscheduledJobRuns.ts— PassproviderIdto executionScheduledTaskCard.tsx— Display provider icon + name on task cardsschema.graphql—llmProviderIdon ScheduledJob, ScheduledJobInput, ScheduledJobPatchsyncSchedulesDocument.ts— GraphQL query/mutation updatessyncSchedulesToBackend.ts— Sync logic for new fieldTest plan