Skip to content

Commit 4932391

Browse files
committed
fix(ui): scope global agent model controls
1 parent 822864c commit 4932391

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

ui/src/ui/chat/session-controls.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,7 @@ async function switchChatModel(state: AppViewState, nextModel: string): Promise<
13781378
try {
13791379
await client.request("sessions.patch", {
13801380
key: targetSessionKey,
1381+
...scopedAgentParamsForSession(state, targetSessionKey),
13811382
model: nextModel || null,
13821383
});
13831384
void refreshVisibleToolsEffectiveForCurrentSessionLazy(state);
@@ -1439,6 +1440,7 @@ async function switchChatThinkingLevel(state: AppViewState, nextThinkingLevel: s
14391440
try {
14401441
await state.client.request("sessions.patch", {
14411442
key: targetSessionKey,
1443+
...scopedAgentParamsForSession(state, targetSessionKey),
14421444
thinkingLevel: normalizedNext ?? null,
14431445
});
14441446
await refreshSessionOptions(state);

ui/src/ui/views/chat.test.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2543,6 +2543,67 @@ describe("chat session controls", () => {
25432543
});
25442544
});
25452545

2546+
it("scopes composer model changes for a selected global-session agent", async () => {
2547+
const { state, request } = createChatHeaderState();
2548+
state.sessionKey = "global";
2549+
state.settings.sessionKey = "global";
2550+
state.assistantAgentId = "beta";
2551+
state.sessionsResult = createSessionsResultFromRows([
2552+
{
2553+
key: "global",
2554+
kind: "global",
2555+
modelProvider: "minimax",
2556+
model: "MiniMax-M2.7",
2557+
updatedAt: 1,
2558+
},
2559+
]);
2560+
const container = document.createElement("div");
2561+
render(renderChatSessionSelect(state), container);
2562+
2563+
clickChatModelOption(container, "openai/gpt-5-mini");
2564+
2565+
expect(request).toHaveBeenCalledWith("sessions.patch", {
2566+
key: "global",
2567+
agentId: "beta",
2568+
model: "openai/gpt-5-mini",
2569+
});
2570+
});
2571+
2572+
it("scopes composer thinking changes for a selected global-session agent", async () => {
2573+
const { state, request } = createChatHeaderState();
2574+
state.sessionKey = "global";
2575+
state.settings.sessionKey = "global";
2576+
state.assistantAgentId = "beta";
2577+
state.sessionsResult = createSessionsResultFromRows([
2578+
{
2579+
key: "global",
2580+
kind: "global",
2581+
modelProvider: "openai",
2582+
model: "gpt-5",
2583+
thinkingLevel: "off",
2584+
thinkingLevels: [
2585+
{ id: "off", label: "off" },
2586+
{ id: "adaptive", label: "adaptive" },
2587+
],
2588+
updatedAt: 1,
2589+
},
2590+
]);
2591+
const container = document.createElement("div");
2592+
render(renderChatSessionSelect(state), container);
2593+
2594+
const adaptive = getThinkingOptions(container).find(
2595+
(option) => option.dataset.chatThinkingOption === "adaptive",
2596+
);
2597+
expect(adaptive).toBeInstanceOf(HTMLButtonElement);
2598+
adaptive?.click();
2599+
2600+
expect(request).toHaveBeenCalledWith("sessions.patch", {
2601+
key: "global",
2602+
agentId: "beta",
2603+
thinkingLevel: "adaptive",
2604+
});
2605+
});
2606+
25462607
it("shows existing speed overrides for providers outside the fast-mode allowlist", async () => {
25472608
const { state, request } = createChatHeaderState();
25482609
state.sessionsResult = createSessionsResultFromRows([

0 commit comments

Comments
 (0)