Skip to content

The agent that grows with you

fix(desktop): a new chat with default selected is created in default

Teknium4fef6077b54d
diff --git a/apps/desktop/src/api/canonical-create-options.test.ts b/apps/desktop/src/api/canonical-create-options.test.ts
index f3290098b40..44a5f392f9c 100644
--- a/apps/desktop/src/api/canonical-create-options.test.ts
+++ b/apps/desktop/src/api/canonical-create-options.test.ts
@@ -16,16 +16,18 @@ const CREATE_KEYS = new Set(Object.keys(doc.components.schemas[createRef.split('
const BASE = { cols: 96, source: 'desktop', profile: 'default' }
// [label, desktopSessionCreateParams output, expected owner frame subset | named refusal]
+// RT-26 (#139298): `profile: 'default'` rides the frame. Omitting it let a backend launched as a
+// named profile (active-profile.json) create the chat in that profile instead.
const CASES: Array<[string, Record<string, unknown>, Record<string, unknown> | RegExp]> = [
- ['inherited workspace', { ...BASE, cwd: '/w', cwd_explicit: false, fast: false }, { cwd: '/w', cwd_explicit: false, service_tier: 'normal' }],
- ['picked workspace', { ...BASE, cwd: '/w', cwd_explicit: true, fast: false }, { cwd: '/w', cwd_explicit: true, service_tier: 'normal' }],
- ['composer effort', { ...BASE, cwd: '/w', cwd_explicit: false, reasoning_effort: 'high', fast: false }, { cwd: '/w', reasoning: 'high', service_tier: 'normal' }],
- ['onboarding minimal effort', { ...BASE, reasoning_effort: 'minimal', fast: false, title: 'Welcome' }, { reasoning: 'minimal', title: 'Welcome', service_tier: 'normal' }],
- ['Bot Chat', { ...BASE, title: 'Bot Chat', hidden: true, follow_profile_config: true }, { follow_profile_config: true, hidden: true }],
- ['Fast speed', { ...BASE, cwd: '/w', cwd_explicit: false, fast: true }, { cwd: '/w', service_tier: 'priority' }],
- ['Ultrafast speed', { ...BASE, fast: true, service_tier: 'ultrafast' }, { service_tier: 'ultrafast' }],
+ ['inherited workspace', { ...BASE, cwd: '/w', cwd_explicit: false, fast: false }, { profile: 'default', cwd: '/w', cwd_explicit: false, service_tier: 'normal' }],
+ ['picked workspace', { ...BASE, cwd: '/w', cwd_explicit: true, fast: false }, { profile: 'default', cwd: '/w', cwd_explicit: true, service_tier: 'normal' }],
+ ['composer effort', { ...BASE, cwd: '/w', cwd_explicit: false, reasoning_effort: 'high', fast: false }, { profile: 'default', cwd: '/w', reasoning: 'high', service_tier: 'normal' }],
+ ['onboarding minimal effort', { ...BASE, reasoning_effort: 'minimal', fast: false, title: 'Welcome' }, { profile: 'default', reasoning: 'minimal', title: 'Welcome', service_tier: 'normal' }],
+ ['Bot Chat', { ...BASE, title: 'Bot Chat', hidden: true, follow_profile_config: true }, { profile: 'default', follow_profile_config: true, hidden: true }],
+ ['Fast speed', { ...BASE, cwd: '/w', cwd_explicit: false, fast: true }, { profile: 'default', cwd: '/w', service_tier: 'priority' }],
+ ['Ultrafast speed', { ...BASE, fast: true, service_tier: 'ultrafast' }, { profile: 'default', service_tier: 'ultrafast' }],
// KoNit-K P1: a manual model pick ships its provider; the owner's create contract admits both.
- ['manual model + provider', { ...BASE, model: 'gpt-5', provider: 'openrouter', fast: false }, { model: 'gpt-5', provider: 'openrouter', service_tier: 'normal' }]
+ ['manual model + provider', { ...BASE, model: 'gpt-5', provider: 'openrouter', fast: false }, { profile: 'default', model: 'gpt-5', provider: 'openrouter', service_tier: 'normal' }]
]
test.each(CASES)('%s: the Desktop create frame is admitted by the owner contract or refused by name', async (_label, params, expected) => {
diff --git a/apps/desktop/src/api/canonical-protocol.test.ts b/apps/desktop/src/api/canonical-protocol.test.ts
index f20e760f327..bdcb61fb470 100644
--- a/apps/desktop/src/api/canonical-protocol.test.ts
+++ b/apps/desktop/src/api/canonical-protocol.test.ts
@@ -91,7 +91,8 @@ test('canonical create retries retain identity', () => {
const first = protocol.prepare('session.create', params)
expect(first).toMatchObject({ source: 'gui', cwd: '/tmp', request_id: expect.any(String) })
expect(protocol.prepare('session.create', { ...params })).toEqual(first)
- expect(first).not.toHaveProperty('profile')
+ // RT-26: the picked profile rides the create, `default` included (a named launch profile would own it otherwise).
+ expect(first).toHaveProperty('profile', 'default')
expect(protocol.prepare('session.create', { ...params, fast: true })).toMatchObject({ service_tier: 'priority' })
const manual = protocol.prepare('session.create', { ...params, model: 'gpt-5', provider: 'custom' })
expect(manual).toMatchObject({ model: 'gpt-5', provider: 'custom' })
diff --git a/apps/desktop/src/api/canonical-protocol.ts b/apps/desktop/src/api/canonical-protocol.ts
index 75794125a5a..d20c7199d57 100644
--- a/apps/desktop/src/api/canonical-protocol.ts
+++ b/apps/desktop/src/api/canonical-protocol.ts
@@ -71,10 +71,6 @@ function mutationSummary(operation: string, value: Record<string, unknown>): str
// stored parent id; the authority has ONE branch, a `branch` mutation on the parent, whose child
// is a local route the authority can restore (a legacy-minted child has no local policy and every
// resume on it answers not_found).
-// The socket is bound to a profile already; only a sibling the host multiplexes rides as `profile`.
-export function siblingRoute(profile: unknown): string | null {
- return typeof profile === 'string' && profile && profile !== 'default' ? profile : null
-}
// A message-level branch (`count` = the selected prefix) keeps rows through `through_message_id`.
// Without that durable id the authority would copy the whole history, so it refuses instead.
@@ -417,8 +413,10 @@ export class CanonicalDesktopProtocol {
if (unsupported.length) { throw new Error(`Canonical gateway does not support explicit session options: ${unsupported.join(', ')}`) }
+ // RT-26: the picked profile always rides, `default` included: a socket launched as a named
+ // profile (active-profile.json) reads an omitted profile as its own launch profile.
const result = Object.fromEntries(Object.entries(params).filter(([key, value]) =>
- ['request_id', 'cwd', 'model', 'provider', 'toolsets', 'reasoning', 'title', 'hidden', 'follow_profile_config', 'service_tier', 'cwd_explicit'].includes(key) || (key === 'profile' && siblingRoute(value))))
+ ['request_id', 'cwd', 'model', 'provider', 'toolsets', 'reasoning', 'title', 'hidden', 'follow_profile_config', 'service_tier', 'cwd_explicit'].includes(key) || (key === 'profile' && typeof value === 'string' && value !== '')))
const key = JSON.stringify(result)
const requestId = params.request_id ?? this.creates.get(key) ?? crypto.randomUUID()