diff --git a/apps/web/components/settings/utility-agent-profile-picker.test.ts b/apps/web/components/settings/utility-agent-profile-picker.test.ts index 1f2f4a2544..531bfc7fcf 100644 --- a/apps/web/components/settings/utility-agent-profile-picker.test.ts +++ b/apps/web/components/settings/utility-agent-profile-picker.test.ts @@ -31,4 +31,35 @@ describe("utilityProfileEligibility", () => { true, ); }); + + describe("with includeWorkspaceProfiles=true (Config Chat context)", () => { + it.each([ + [ + "non-inference workspace profile", + profile({ workspace_id: "ws-1", inference_capable: false }), + true, + ], + ["non-inference global profile", profile({ inference_capable: false }), true], + [ + "unknown inference workspace profile", + profile({ workspace_id: "ws-1", inference_capable: undefined }), + true, + ], + ])("returns %s = %s", (_label, candidate, expected) => { + expect(utilityProfileEligibility(candidate, true, true)).toBe(expected); + }); + + it.each([ + ["CLI passthrough", true], + ["disabled", false], + ])("still rejects %s profile", (_label, enabled) => { + expect( + utilityProfileEligibility( + profile({ workspace_id: "ws-1", cli_passthrough: true, enabled }), + true, + true, + ), + ).toBe(false); + }); + }); }); diff --git a/apps/web/components/settings/utility-agent-profile-picker.tsx b/apps/web/components/settings/utility-agent-profile-picker.tsx index de0467ed16..629d3c9f88 100644 --- a/apps/web/components/settings/utility-agent-profile-picker.tsx +++ b/apps/web/components/settings/utility-agent-profile-picker.tsx @@ -10,9 +10,10 @@ export const utilityProfileEligibility = ( includeWorkspaceProfiles = false, ) => profile.enabled !== false && - profile.inference_capable === true && + !profile.cli_passthrough && + (includeWorkspaceProfiles || profile.inference_capable === true) && (dynamicRoutingEnabled || profile.kind !== "dynamic") && - (includeWorkspaceProfiles || (!profile.cli_passthrough && !profile.workspace_id)); + (includeWorkspaceProfiles || !profile.workspace_id); type UtilityAgentProfilePickerProps = { profiles: AgentProfileOption[];