Skip to content

Commit 7edcaa3

Browse files
bugulodemostanis
authored andcommitted
fix(app): agent switch should not reset thinking level (anomalyco#17470)
1 parent f4e3f2f commit 7edcaa3

2 files changed

Lines changed: 25 additions & 2 deletions

File tree

packages/app/e2e/session/session-model-persistence.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,3 +349,25 @@ test("session model restore across workspaces", async ({ page, withProject }) =>
349349
await waitFooter(page, firstState)
350350
})
351351
})
352+
353+
test("variant preserved when switching agent modes", async ({ page, withProject }) => {
354+
await page.setViewportSize({ width: 1440, height: 900 })
355+
356+
await withProject(async ({ directory, gotoSession }) => {
357+
await gotoSession()
358+
359+
await ensureVariant(page, directory)
360+
const updated = await chooseDifferentVariant(page)
361+
362+
const available = await agents(page)
363+
const other = available.find((name) => name !== updated.agent)
364+
test.skip(!other, "only one agent available")
365+
if (!other) return
366+
367+
await choose(page, promptAgentSelector, other)
368+
await waitFooter(page, { agent: other, variant: updated.variant })
369+
370+
await choose(page, promptAgentSelector, updated.agent)
371+
await waitFooter(page, { agent: updated.agent, variant: updated.variant })
372+
})
373+
})

packages/app/src/context/local.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,11 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
192192
model: item.model,
193193
variant: item.variant ?? null,
194194
})
195+
const prev = scope()
195196
const next = {
196197
agent: item.name,
197-
model: item.model,
198-
variant: item.variant,
198+
model: item.model ?? prev?.model,
199+
variant: item.variant ?? prev?.variant,
199200
} satisfies State
200201
const session = id()
201202
if (session) {

0 commit comments

Comments
 (0)