feat(settings): restore agent and model defaults#2723
Conversation
Greptile SummaryThis PR restores global and automation-specific default agent and model settings in the Agents settings page, and applies those defaults when creating tasks, conversations, and automation runs while respecting per-flow overrides.
Confidence Score: 4/5Safe to merge with one fix: switching the default agent via the hover card leaves the previous model setting intact, which can silently pre-select a stale model for the new agent. The backend resolution logic and the new settings schema are solid. The settings-page path (DefaultAgentSelector) correctly resets the model on agent change. However, the hover-card path (agent-info-card.tsx handleSetDefaultAgent) skips that reset — a stale defaultModel from the previous agent remains in storage and will be applied to the new agent in both the Create Conversation modal and task-creation flows if the model ID happens to be valid for the new agent. apps/emdash-desktop/src/renderer/lib/components/agent-selector/agent-info-card.tsx — handleSetDefaultAgent should reset defaultModel to null when switching the default agent, mirroring the behaviour in DefaultAgentSelector.tsx.
|
| Filename | Overview |
|---|---|
| apps/emdash-desktop/src/main/core/automations/actions/taskCreate.ts | Reworked provider/model resolution: uses defaultAutomationAgent from settings (registry-backed) and conditionally applies defaultAutomationModel only when the automation has no explicit provider. Logic is sound and well-commented. |
| apps/emdash-desktop/src/main/core/automations/actions/taskCreate.test.ts | Adds four new test cases covering automation default agent/model resolution, explicit-model override, and ACP startup. Coverage is thorough and assertions match the intended behaviour. |
| apps/emdash-desktop/src/main/core/settings/schema.ts | Adds defaultModel, defaultAutomationAgent, and defaultAutomationModel to both the schema map and the zod object; new schemas are consistent with existing patterns. |
| apps/emdash-desktop/src/main/core/settings/settings-registry.ts | Registers sane defaults for the three new settings keys (defaultAutomationAgent mirrors DEFAULT_AGENT_ID, model defaults are null). |
| apps/emdash-desktop/src/renderer/features/settings/agents-page/DefaultAgentSelector.tsx | Expanded to show two agent+model rows (global default and automation default). Agent change correctly clears the model via updateDefaultModel(null) in handleAgentChange. |
| apps/emdash-desktop/src/renderer/features/settings/agents-page/DefaultModelSelect.tsx | New component for selecting a default model. Cleanup effect guards against stale model IDs when agent changes; placeholder path handles agents without selectable models. |
| apps/emdash-desktop/src/renderer/lib/components/agent-selector/agent-info-card.tsx | Adds DefaultModelSelect to the hover card, but handleSetDefaultAgent does not reset defaultModel on agent switch — a stale model from the previous agent can silently carry over to the new one when model IDs overlap. |
| apps/emdash-desktop/src/renderer/features/conversations/create-conversation-modal.tsx | Applies defaultModel setting to the model selector when the provider matches the default and the user hasn't touched the field. Provider change correctly resets modelTouched. |
| apps/emdash-desktop/src/renderer/features/tasks/task-config/initial-conversation-section.tsx | New options (defaultAgentSettingKey, defaultModelSettingKey, applyDefaultModel) cleanly parameterise the default-application logic; modelTouched guard prevents default from overriding explicit user selection. |
| apps/emdash-desktop/src/renderer/features/automations/useAutomationFormState.ts | Passes automation-specific setting keys and applyDefaultModel: !seed to useInitialConversationState, correctly suppressing defaults when editing an existing automation. |
| apps/emdash-desktop/src/renderer/features/automations/useAutomationSettingsAutoSave.ts | Now saves model in ConversationConfig and tracks model and useChatUi in the auto-save effect dependency array. |
| apps/emdash-desktop/src/renderer/features/conversations/use-effective-provider.ts | Exposes defaultProviderId in the return value and accepts defaultAgentSettingKey to support both global and automation-scoped defaults. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Automation Run triggered] --> B{automation.conversationConfig?.provider set?}
B -- No --> C[provider = defaultAutomationAgent setting]
B -- No --> D[defaultAutomationModel = setting value]
B -- Yes --> E[provider = configuredProvider]
B -- Yes --> F[defaultAutomationModel = null]
C --> G[model = automation.model OR defaultAutomationModel OR undefined]
D --> G
E --> H[model = automation.model OR undefined]
F --> H
G --> I[createConversation with resolved provider + model]
H --> I
J[Agent default changed via Settings page] --> K[updateDefaultAgent + updateDefaultModel null]
L[Agent default changed via Hover card] --> M[updateDefaultAgent only — defaultModel NOT cleared]
M -.->|stale model persists| N[defaultModel setting]
K --> O[defaultModel setting cleared]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Automation Run triggered] --> B{automation.conversationConfig?.provider set?}
B -- No --> C[provider = defaultAutomationAgent setting]
B -- No --> D[defaultAutomationModel = setting value]
B -- Yes --> E[provider = configuredProvider]
B -- Yes --> F[defaultAutomationModel = null]
C --> G[model = automation.model OR defaultAutomationModel OR undefined]
D --> G
E --> H[model = automation.model OR undefined]
F --> H
G --> I[createConversation with resolved provider + model]
H --> I
J[Agent default changed via Settings page] --> K[updateDefaultAgent + updateDefaultModel null]
L[Agent default changed via Hover card] --> M[updateDefaultAgent only — defaultModel NOT cleared]
M -.->|stale model persists| N[defaultModel setting]
K --> O[defaultModel setting cleared]
Reviews (4): Last reviewed commit: "feat(settings): restore agent and model ..." | Re-trigger Greptile
fa76d25 to
42cfa49
Compare
|
Addressed the review feedback in the amended commit 42cfa49:
|
9d65899 to
6bc6514
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
98b40ea to
12d66b2
Compare
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Summary
Why
Automations and repeated task creation need predictable defaults for both the harness and the underlying model. This brings those settings back in the central Agents settings page and keeps the hover-card shortcut aligned with the same app setting.
Linear: https://linear.app/general-action/issue/ENG-1687/bring-back-default-agent-and-default-underlying-model-settings
Screenshot
Validation