feat: allow model selection in all single-agent sessions

Generalize the scratchpad-only model/reasoning-effort selector to work
in any session whose pattern has exactly one agent. This enables model
switching above the chat input for project 1-on-1 chats, not just
scratchpads.

- Rename ScratchpadSessionConfig -> SessionModelConfig across domain,
  contracts, IPC, preload, and renderer
- Replace isScratchpadProject guard with agents.length === 1 check in
  EryxAppService.updateSessionModelConfig and ChatPane pills gate
- Apply session model config in buildEffectivePattern whenever present,
  regardless of project type
- Seed sessionModelConfig on session creation for any single-agent
  pattern

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
David Kaya
2026-03-25 22:41:46 +01:00
co-authored by Copilot
parent 46b5de472e
commit 968ae37279
10 changed files with 76 additions and 74 deletions
+12 -12
View File
@@ -3,12 +3,12 @@ import { describe, expect, test } from 'bun:test';
import type { PatternDefinition } from '@shared/domain/pattern';
import {
applySessionApprovalSettings,
applyScratchpadSessionConfig,
createScratchpadSessionConfig,
applySessionModelConfig,
createSessionModelConfig,
resolveSessionApprovalSettings,
resolveSessionToolingSelection,
resolveSessionTitle,
resolveScratchpadSessionConfig,
resolveSessionModelConfig,
type SessionRecord,
} from '@shared/domain/session';
@@ -58,18 +58,18 @@ function createSession(overrides?: Partial<SessionRecord>): SessionRecord {
};
}
describe('scratchpad session config helpers', () => {
test('captures the initial scratchpad model settings from the primary agent', () => {
expect(createScratchpadSessionConfig(createPattern())).toEqual({
describe('session model config helpers', () => {
test('captures the initial model settings from the primary agent', () => {
expect(createSessionModelConfig(createPattern())).toEqual({
model: 'gpt-5.4',
reasoningEffort: 'high',
});
});
test('resolves persisted scratchpad overrides over the pattern defaults', () => {
const config = resolveScratchpadSessionConfig(
test('resolves persisted session overrides over the pattern defaults', () => {
const config = resolveSessionModelConfig(
createSession({
scratchpadConfig: {
sessionModelConfig: {
model: 'claude-opus-4.5',
reasoningEffort: 'medium',
},
@@ -83,12 +83,12 @@ describe('scratchpad session config helpers', () => {
});
});
test('applies scratchpad settings only to the primary agent', () => {
test('applies session model settings only to the primary agent', () => {
const pattern = createPattern();
const updated = applyScratchpadSessionConfig(
const updated = applySessionModelConfig(
pattern,
createSession({
scratchpadConfig: {
sessionModelConfig: {
model: 'gpt-5.4-mini',
reasoningEffort: 'low',
},