Skip to content

feat(settings): restore agent and model defaults#2723

Draft
arnestrickmann wants to merge 1 commit into
generalaction:mainfrom
arnestrickmann:arne/eng-1687-bring-back-default-agent-and-default-underlying-model
Draft

feat(settings): restore agent and model defaults#2723
arnestrickmann wants to merge 1 commit into
generalaction:mainfrom
arnestrickmann:arne/eng-1687-bring-back-default-agent-and-default-underlying-model

Conversation

@arnestrickmann

@arnestrickmann arnestrickmann commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Restore global default agent and default model settings in the Agents settings tab.
  • Add separate automation defaults for agent and model without changing the automation creation flow.
  • Apply saved defaults when creating tasks, conversations, and automation runs, while preserving per-flow overrides.
  • Keep the model selector slot stable for agents without selectable models and explain the disabled state in a tooltip.

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

CleanShot 2026-06-30 at 12 17 59

Validation

  • corepack pnpm run typecheck
  • corepack pnpm exec vitest run --project node src/main/core/automations/actions/taskCreate.test.ts src/renderer/tests/conversation-provider-selection.test.ts
  • focused oxlint and oxfmt checks

@arnestrickmann arnestrickmann marked this pull request as ready for review June 30, 2026 10:21
@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR restores global default agent and default model settings in the Agents settings tab, adding separate automation-specific defaults (defaultAutomationAgent / defaultAutomationModel). Defaults are applied during task creation, conversation creation, and automation runs, using a modelTouched guard to prevent settings changes from overriding user selections mid-session.

  • Three new schema keys (defaultModel, defaultAutomationAgent, defaultAutomationModel) are added with null defaults and wired through the settings registry, schema map, and both renderer surfaces.
  • taskCreate.ts resolves the effective provider/model for automation runs via a fallback chain (defaultAutomationAgent → defaultAgent → DEFAULT_AGENT_ID), gating defaultAutomationModel on the provider matching the computed default agent; the automation form uses applyDefaultModel: false to prevent initialization from triggering spurious auto-saves.
  • useEffectiveProvider now exposes defaultProviderId so callers can skip applying a defaultModel when the user has overridden the agent to something other than the stored default.

Confidence Score: 5/5

Safe 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.

Important Files Changed

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]
Loading
%%{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]
Loading

Reviews (2): Last reviewed commit: "feat(settings): restore agent and model ..." | Re-trigger Greptile

Comment thread apps/emdash-desktop/src/main/core/automations/actions/taskCreate.ts
@arnestrickmann arnestrickmann marked this pull request as draft June 30, 2026 10:34
@arnestrickmann arnestrickmann force-pushed the arne/eng-1687-bring-back-default-agent-and-default-underlying-model branch from fa76d25 to 42cfa49 Compare June 30, 2026 10:56
@arnestrickmann

arnestrickmann commented Jun 30, 2026

Copy link
Copy Markdown
Contributor Author

Addressed the review feedback in the amended commit 42cfa49:

  • Automation forms now opt out of applying the runtime automation default model into local form state. Opening an existing automation with no explicit model keeps conversationConfig.model unset, so future runs continue to use the current defaultAutomationModel fallback instead of silently snapshotting it on form open.
  • Existing explicit automation models still seed into the form through the existing seedModel path and can be changed by the user.
  • The disabled no-model placeholder no longer presents itself as an activatable ARIA button.
  • I intentionally kept defaultAutomationModel independent from the global defaultModel; null for the automation default means use the agent default model, not inherit task/conversation defaults. Added a backend comment to make that explicit.

@arnestrickmann

Copy link
Copy Markdown
Contributor Author

@greptile

@arnestrickmann arnestrickmann force-pushed the arne/eng-1687-bring-back-default-agent-and-default-underlying-model branch from 42cfa49 to 9d65899 Compare July 1, 2026 15:15
@arnestrickmann arnestrickmann force-pushed the arne/eng-1687-bring-back-default-agent-and-default-underlying-model branch from 9d65899 to 6bc6514 Compare July 2, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant