Skip to content

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

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

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

  • New settings (defaultModel, defaultAutomationAgent, defaultAutomationModel) are added to the schema and registry with safe defaults; the backend resolver in taskCreate.ts uses them with a clear intentional policy: automation model defaults only apply when no explicit provider is configured.
  • Frontend: useInitialConversationState gains parameterised setting keys and an applyDefaultModel gate (guarded by a modelTouched flag); create-conversation-modal and the settings page both surface the new defaults with consistent reset-button affordances.
  • Hover-card shortcut (agent-info-card.tsx) adds an inline DefaultModelSelect for the current default agent, but handleSetDefaultAgent does not reset defaultModel on agent change — unlike the settings-page path which explicitly calls updateDefaultModel(null).

Confidence Score: 4/5

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

Important Files Changed

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

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

Comment thread apps/emdash-desktop/src/main/core/automations/actions/taskCreate.ts Outdated
@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 2 times, most recently from 9d65899 to 6bc6514 Compare July 2, 2026 13:09
@arnestrickmann arnestrickmann marked this pull request as ready for review July 7, 2026 01:01
@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

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.

@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

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.

@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 98b40ea to 12d66b2 Compare July 7, 2026 19:09
@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

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.

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