From c852de84bae91e7c4d9bfa9192df5528c0c8ca25 Mon Sep 17 00:00:00 2001 From: mateo Date: Sat, 10 Oct 2026 23:40:01 +0000 Subject: [PATCH] fix(ui): look decision models up again each time the Decisions playground opens Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../SystemOneUI.integration.test.tsx | 19 +++++++++++++++++++ .../systemOneUI/useDecisionModels.ts | 1 + 2 files changed, 20 insertions(+) diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/systemOneUI/SystemOneUI.integration.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/systemOneUI/SystemOneUI.integration.test.tsx index 33aee764fbb..e600c1b469b 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/systemOneUI/SystemOneUI.integration.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/systemOneUI/SystemOneUI.integration.test.tsx @@ -551,6 +551,25 @@ describe("SystemOneUI integration", () => { expect(JSON.parse(mockFetch.mock.calls[0]?.[1]?.body as string).model).toBe("pplx-decider"); }); + it("looks the decision models up again when the playground is reopened within the cache window", async () => { + mockModelLookup.mockResolvedValueOnce(modelInfoResponse([{ model_name: "gpt-5.5", mode: "chat" }])); + const queryClient = new QueryClient({ defaultOptions: { mutations: { retry: false } } }); + const page = ( + + + + ); + const first = rtlRender(page); + expect(await screen.findByRole("link", { name: "Add a decision model" })).toBeInTheDocument(); + first.unmount(); + + mockModelLookup.mockResolvedValueOnce(modelInfoResponse(DECISION_AND_CHAT_MODELS)); + rtlRender(page); + const picker = await screen.findByRole("combobox", { name: "Decision model" }); + await waitFor(() => expect(picker).toHaveValue("jev-latest")); + expect(mockModelLookup).toHaveBeenCalledTimes(2); + }); + it("routes a configured TypeSafe model through the same proxy endpoint", async () => { const user = userEvent.setup(); mockModelLookup.mockResolvedValue(modelInfoResponse([{ model_name: "typesafe/jev-latest", mode: "evaluation" }])); diff --git a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/systemOneUI/useDecisionModels.ts b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/systemOneUI/useDecisionModels.ts index c694b6384e5..51477554f18 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/playground/components/systemOneUI/useDecisionModels.ts +++ b/ui/litellm-dashboard/src/app/(dashboard)/playground/components/systemOneUI/useDecisionModels.ts @@ -26,6 +26,7 @@ export function useDecisionModels( enabled: lookupApiKey !== "", retry: false, staleTime: 60 * 1000, + refetchOnMount: "always" as const, }; const query = useQuery(queryOptions); return { decisionModels: query.data ?? NO_DECISION_MODELS, isLoaded: query.isSuccess };