Skip to content

Commit b3f0c4b

Browse files
authored
fix: switching agents can show another agent's auth and quota (#132894)
Switching selected agents now clears and reloads agent-owned auth, identity, account, plan, and quota state. Delayed prior-agent responses and routine Gateway snapshots can no longer overwrite the current view, and sidebar authentication attention follows the same ownership while fixed sessions and reconnect behavior remain unchanged. Fixes #129215
1 parent a7766f1 commit b3f0c4b

12 files changed

Lines changed: 772 additions & 262 deletions

‎ui/src/app/app-host.chat-metadata.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ it("rebinds global chat metadata immediately on agent selection and follows late
156156
state.connected = true;
157157
state.sessionKey = "global";
158158
state.assistantAgentId = "work";
159+
state.loadAssistantIdentity = vi.fn(async () => undefined);
159160
state.chatMessage = "Keep this draft";
160161
state.chatError = "Keep this error";
161162
const messages = state.chatMessages;
@@ -164,15 +165,15 @@ it("rebinds global chat metadata immediately on agent selection and follows late
164165
expect(state.chatModelCatalog[0]?.available).toBe(false);
165166
applySelectedChatAgent(state, "main");
166167
await vi.waitFor(() =>
167-
expect(request).toHaveBeenLastCalledWith("chat.metadata", {
168+
expect(request).toHaveBeenCalledWith("chat.metadata", {
168169
agentId: "main",
169170
sessionKey: "global",
170171
}),
171172
);
172173
ready = true;
173174
invalidateChatMetadataStore(client);
174175
await vi.waitFor(() => expect(state.chatModelCatalog[0]?.available).toBe(true));
175-
expect(request).toHaveBeenCalledTimes(3);
176+
expect(request.mock.calls.filter(([method]) => method === "chat.metadata")).toHaveLength(3);
176177
expect(state.chatMessage).toBe("Keep this draft");
177178
expect(state.chatError).toBe("Keep this error");
178179
expect(state.chatMessages).toBe(messages);

0 commit comments

Comments
 (0)