Skip to content

Commit c6d9e29

Browse files
fix(models): respect auth order in picker label
1 parent 0b9c1c0 commit c6d9e29

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

src/auto-reply/reply/commands-models.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,36 @@ describe("handleModelsCommand", () => {
703703
expect(authLabelParams.acceptedProviderIds).toEqual(["openai-codex"]);
704704
});
705705

706+
it("keeps custom OpenAI-compatible model list labels on OpenAI auth", async () => {
707+
modelAuthLabelMocks.resolveModelAuthLabel.mockImplementation((params: unknown) => {
708+
const acceptedProviderIds = (params as { acceptedProviderIds?: string[] })
709+
.acceptedProviderIds;
710+
return acceptedProviderIds?.[0] === "openai"
711+
? "api-key (env: OPENAI_API_KEY)"
712+
: "oauth (codex-runtime)";
713+
});
714+
715+
const result = await handleModelsCommand(
716+
buildParams("/models openai", {
717+
models: {
718+
providers: {
719+
openai: {
720+
baseUrl: "https://proxy.example.test/v1",
721+
models: [],
722+
},
723+
},
724+
},
725+
}),
726+
true,
727+
);
728+
729+
expect(result?.reply?.text).toContain("Models (openai · 🔑 api-key (env: OPENAI_API_KEY))");
730+
const [[authLabelParams]] = modelAuthLabelMocks.resolveModelAuthLabel.mock
731+
.calls as unknown as Array<[{ provider?: string; acceptedProviderIds?: string[] }]>;
732+
expect(authLabelParams.provider).toBe("openai");
733+
expect(authLabelParams.acceptedProviderIds).toEqual(["openai"]);
734+
});
735+
706736
it("uses spawned workspace for direct /models provider visibility", async () => {
707737
modelProviderAuthMocks.authenticatedProviders = new Set(["anthropic"]);
708738
const params = buildParams("/models");

0 commit comments

Comments
 (0)