Skip to content

Commit 89e158f

Browse files
committed
fix: harden azure custom-provider verification coverage (openclaw#29421) (thanks @kunalk16)
1 parent 720e147 commit 89e158f

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Docs: https://docs.openclaw.ai
7474
### Fixes
7575

7676
- Config/Doctor group allowlist diagnostics: align `groupPolicy: "allowlist"` warnings with per-channel runtime semantics by excluding Google Chat sender-list checks and by warning when no-fallback channels (for example iMessage) omit `groupAllowFrom`, with regression coverage. (#28477) Thanks @tonydehnke.
77+
- Onboarding/Custom providers: use Azure OpenAI-specific verification auth/payload shape (`api-key`, deployment-path chat completions payload) when probing Azure endpoints so valid Azure custom-provider setup no longer fails preflight. (#29421) Thanks @kunalk16.
7778

7879
## 2026.2.26
7980

src/commands/onboard-custom.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,45 @@ describe("promptCustomApiConfig", () => {
131131
expect(JSON.parse(firstCall?.body ?? "{}")).toMatchObject({ max_tokens: 1 });
132132
});
133133

134+
it("uses azure-specific headers and body for openai verification probes", async () => {
135+
const prompter = createTestPrompter({
136+
text: [
137+
"https://my-resource.openai.azure.com",
138+
"azure-test-key",
139+
"gpt-4.1",
140+
"custom",
141+
"alias",
142+
],
143+
select: ["plaintext", "openai"],
144+
});
145+
const fetchMock = stubFetchSequence([{ ok: true }]);
146+
147+
await runPromptCustomApi(prompter);
148+
149+
const firstCall = fetchMock.mock.calls[0];
150+
const firstUrl = firstCall?.[0];
151+
const firstInit = firstCall?.[1] as
152+
| { body?: string; headers?: Record<string, string> }
153+
| undefined;
154+
if (typeof firstUrl !== "string") {
155+
throw new Error("Expected first verification call URL");
156+
}
157+
const parsedBody = JSON.parse(firstInit?.body ?? "{}");
158+
159+
expect(firstUrl).toContain("/openai/deployments/gpt-4.1/chat/completions");
160+
expect(firstUrl).toContain("api-version=2024-10-21");
161+
expect(firstInit?.headers?.["api-key"]).toBe("azure-test-key");
162+
expect(firstInit?.headers?.Authorization).toBeUndefined();
163+
expect(firstInit?.body).toBeDefined();
164+
expect(parsedBody).toMatchObject({
165+
messages: [{ role: "user", content: "Hi" }],
166+
max_completion_tokens: 5,
167+
stream: false,
168+
});
169+
expect(parsedBody).not.toHaveProperty("model");
170+
expect(parsedBody).not.toHaveProperty("max_tokens");
171+
});
172+
134173
it("uses expanded max_tokens for anthropic verification probes", async () => {
135174
const prompter = createTestPrompter({
136175
text: ["https://example.com", "test-key", "detected-model", "custom", "alias"],

0 commit comments

Comments
 (0)