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>
This commit is contained in:
mateo 2026-10-10 23:40:01 +00:00
parent 00cb4d0f01
commit c852de84ba
2 changed files with 20 additions and 0 deletions

View file

@ -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 = (
<QueryClientProvider client={queryClient}>
<SystemOneUI accessToken="session-key" />
</QueryClientProvider>
);
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" }]));

View file

@ -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 };