fix(plugins): split inference capability requirement by context

Plugin/sessionless utility pickers (includeWorkspaceProfiles=false)
still require inference_capable=true. Configuration Chat context
(includeWorkspaceProfiles=true) preserves eligibility for non-inference
workspace profiles while still rejecting CLI passthrough and disabled
profiles universally.

Fixes regression where ConfigChatAgentSection lost valid custom TUI
profiles after the inference_capable tightening.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
ayattara
2026-08-25 12:07:42 +00:00
parent 563882f709
commit 55a7f90aad
2 changed files with 34 additions and 2 deletions
@@ -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);
});
});
});
@@ -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[];