feat(settings): restore agent and model defaults#2723
Conversation
Greptile SummaryThis PR restores global default agent and default model settings in the Agents settings tab, adding separate automation-specific defaults (
Confidence Score: 5/5Safe to merge; the core fallback chains and modelTouched guards are correct across all three call sites. The agent/model fallback chain in taskCreate.ts is well-structured and tested. The modelTouched guard is consistently applied in both initial-conversation-section and create-conversation-modal, and the applyDefaultModel: false option for the automation form cleanly prevents the auto-save race. The one inconsistency found — the Reset button not clearing the paired model setting alongside the agent — is handled by DefaultModelSelect's stale-model useEffect in all practical scenarios and has no impact on runtime automation behaviour. DefaultAgentSelector.tsx — the Reset button callback could also clear the paired model key for full symmetry with handleAgentChange.
|
| Filename | Overview |
|---|---|
| apps/emdash-desktop/src/main/core/automations/actions/taskCreate.ts | Adds defaultAutomationAgent/defaultAutomationModel fallback chain with correct provider-equality gate; model vs automation model precedence is sound and well-tested. |
| apps/emdash-desktop/src/main/core/automations/actions/taskCreate.test.ts | New tests cover default agent+model without explicit provider, and explicit automation model taking precedence; good coverage of the new logic paths. |
| apps/emdash-desktop/src/main/core/settings/schema.ts | Adds defaultModel, defaultAutomationAgent, defaultAutomationModel to both APP_SETTINGS_SCHEMA_MAP and appSettingsSchema; schema and registry are consistent. |
| apps/emdash-desktop/src/renderer/features/settings/agents-page/DefaultAgentSelector.tsx | ResetToDefaultButton for agent doesn't clear model alongside the agent reset, inconsistent with handleAgentChange; otherwise the selector/model-row composition is clean. |
| apps/emdash-desktop/src/renderer/features/settings/agents-page/DefaultModelSelect.tsx | New component; stale-model guard via useEffect is correct and the disabled placeholder path is stable. |
| apps/emdash-desktop/src/renderer/features/tasks/conversations/use-effective-provider.ts | Exposes defaultProviderId to callers; parameterised defaultAgentSettingKey is a clean extension with a safe default. |
| apps/emdash-desktop/src/renderer/features/tasks/conversations/initial-conversation-section.tsx | modelTouched guard correctly defers default application until settings load and is cleared on project/provider change; applyDefaultModel: false for automation form prevents spurious auto-saves. |
| apps/emdash-desktop/src/renderer/features/tasks/conversations/create-conversation-modal.tsx | modelTouched guard and defaultModel derivation mirror initial-conversation-section; provider change correctly resets both model and touched flag. |
| apps/emdash-desktop/src/renderer/features/automations/useAutomationFormState.ts | seedModel seeded via the modelSeeded guard sets modelTouched=true, preserving existing automation model without triggering auto-save on open. |
| apps/emdash-desktop/src/renderer/features/automations/useAutomationSettingsAutoSave.ts | Adds model to auto-save dependency and ConversationConfig; with applyDefaultModel: false the model starts null and only changes on explicit user action, so no spurious saves. |
| apps/emdash-desktop/src/renderer/lib/components/agent-selector/agent-info-card.tsx | DefaultModelSelect mounted conditionally when isDefaultAgent && modelOptions; stale-model guard in DefaultModelSelect handles model cleanup when agent changes via the toggle. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Automation Run Triggered] --> B[taskCreate.ts: executeTaskCreate]
B --> C{automation.conversationConfig.provider?}
C -- empty/falsy --> D[Read defaultAutomationAgent setting]
D --> E{defaultAutomationAgent set?}
E -- yes --> F[provider = defaultAutomationAgent]
E -- no --> G[Read defaultAgent setting]
G --> H{defaultAgent set?}
H -- yes --> I[provider = defaultAgent]
H -- no --> J[provider = DEFAULT_AGENT_ID]
C -- set --> K[provider = automation provider]
F & I & J --> L{provider == defaultAutomationAgent?}
K --> L
L -- yes --> M[Read defaultAutomationModel]
L -- no --> N[model = undefined]
M --> O{automation.conversationConfig.model set?}
O -- yes --> P[model = automation model]
O -- no --> Q{defaultAutomationModel set?}
Q -- yes --> R[model = defaultAutomationModel]
Q -- no --> N
P & R & N --> S[createConversation with provider + model]
%%{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[taskCreate.ts: executeTaskCreate]
B --> C{automation.conversationConfig.provider?}
C -- empty/falsy --> D[Read defaultAutomationAgent setting]
D --> E{defaultAutomationAgent set?}
E -- yes --> F[provider = defaultAutomationAgent]
E -- no --> G[Read defaultAgent setting]
G --> H{defaultAgent set?}
H -- yes --> I[provider = defaultAgent]
H -- no --> J[provider = DEFAULT_AGENT_ID]
C -- set --> K[provider = automation provider]
F & I & J --> L{provider == defaultAutomationAgent?}
K --> L
L -- yes --> M[Read defaultAutomationModel]
L -- no --> N[model = undefined]
M --> O{automation.conversationConfig.model set?}
O -- yes --> P[model = automation model]
O -- no --> Q{defaultAutomationModel set?}
Q -- yes --> R[model = defaultAutomationModel]
Q -- no --> N
P & R & N --> S[createConversation with provider + model]
Reviews (2): 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:
|
42cfa49 to
9d65899
Compare
9d65899 to
6bc6514
Compare
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