Skip to content

fix: update Azure OpenAI API version default to preview#82026

Closed
leoge007 wants to merge 7 commits into
openclaw:mainfrom
leoge007:fix/azure-api-version-2025-04
Closed

fix: update Azure OpenAI API version default to preview#82026
leoge007 wants to merge 7 commits into
openclaw:mainfrom
leoge007:fix/azure-api-version-2025-04

Conversation

@leoge007

@leoge007 leoge007 commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix azure-openai-responses provider returning "400 API version not supported" by updating the default Azure API version from 2024-12-01-preview to preview.

Problem

The current default api-version=2024-12-01-preview does not work for our Azure OpenAI Responses endpoint. Calls to azure-openai-responses/gpt-5.5 can fail with 400 API version not supported when AZURE_OPENAI_API_VERSION is unset and the transport falls back to the built-in default.

Root Cause

resolveAzureOpenAIApiVersion() in src/agents/openai-transport-stream.ts defaults to "2024-12-01-preview" when AZURE_OPENAI_API_VERSION is unset. The Azure /openai/v1/responses endpoint in our live resource accepts api-version=preview; dated preview values tested against the same endpoint returned 400 API version not supported.

Changes

  1. src/agents/openai-transport-stream.ts - change DEFAULT_AZURE_OPENAI_API_VERSION to "preview".
  2. extensions/openai/image-generation-provider.ts - change the matching Azure image-generation default to "preview".
  3. src/agents/openai-transport-stream.test.ts - update the Azure default assertion.
  4. extensions/openai/image-generation-provider.test.ts - update Azure image URL assertions.
  5. docs/providers/openai.md - document the new default.

Real behavior proof

  • Behavior or issue addressed: Azure OpenAI Responses calls for azure-openai-responses/gpt-5.5 fail with 400 API version not supported when OpenClaw falls back to the old default api-version=2024-12-01-preview.
  • Real environment tested: Local OpenClaw Gateway 2026.5.12 on macOS, using a real Azure OpenAI resource at https://<resource>.openai.azure.com/openai/v1 and deployment/model gpt-5.5. Resource hostname, key, and account details are redacted.
  • Exact steps or command run after this patch: Ran live Azure/OpenClaw smoke tests against the same Azure resource and model:
    curl -sS -X POST 'https://<resource>.openai.azure.com/openai/v1/responses?api-version=preview' \
      -H 'api-key: <redacted>' \
      -H 'content-type: application/json' \
      -d '{"model":"gpt-5.5","input":"Reply with OK only."}'
    
    openclaw infer model run --gateway \
      --model azure-openai-responses/gpt-5.5 \
      --thinking medium \
      --prompt 'Reply with OK only.' \
      --json
    
    openclaw agent --agent main \
      --model azure-openai-responses/gpt-5.5 \
      --thinking medium \
      --message 'Smoke test Azure gpt-5.5. Reply with OK only.' \
      --json
  • Evidence after fix: Live output from the real setup:
    POST /openai/v1/responses?api-version=preview
    model: gpt-5.5
    status: 200
    response.status: completed
    
    Negative controls against the same resource:
    api-version=2025-04-01-preview -> 400 API version not supported
    api-version=2025-03-01-preview -> 400 API version not supported
    api-version=2024-12-01-preview -> 400 API version not supported
    
    openclaw infer model run:
    ok: true
    provider: azure-openai-responses
    model: gpt-5.5
    output: OK
    
    openclaw agent:
    status: ok
    winnerProvider: azure-openai-responses
    winnerModel: gpt-5.5
    fallbackUsed: false
    finalAssistantVisibleText: OK
    
  • Observed result after fix: The Azure Responses call succeeds with api-version=preview; the OpenClaw model-run path and full agent path both return OK through azure-openai-responses/gpt-5.5 without fallback.
  • What was not tested: I did not run a live Azure image-generation call; image-generation coverage here is unit-test expectation alignment for the shared Azure default.

Related

Fixes issue where fallback chains including azure-openai-responses/gpt-5.5 can fail because the default Azure API version is rejected before a successful model response is produced.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling extensions: openai size: L triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 15, 2026
@clawsweeper

clawsweeper Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: passed.

Summary
This PR changes the Azure OpenAI Responses default API version to preview and updates the unset-env unit test expectation.

Reproducibility: yes. with a real Azure OpenAI Responses resource; current main clearly passes the obsolete default into the SDK, and the PR body supplies redacted negative-control and after-fix output for that path.

Real behavior proof
Sufficient (terminal): The PR body includes redacted after-fix terminal/live output for a real Azure Responses call, openclaw infer model run, and openclaw agent, plus negative controls for dated preview values.

Next step before merge
No repair job is needed; the opted-in automerge path can let exact-head checks and mergeability gate the clean two-line patch.

Security
Cleared: The final diff changes one runtime default string and one unit-test expectation; it does not touch dependencies, workflows, permissions, secret handling, or code-execution surfaces.

Review details

Best possible solution:

Land this narrow Responses transport default/test update as the canonical fix for the paired Azure Responses bug, leaving image-generation and docs default changes to a separately proven follow-up if needed.

Do we have a high-confidence way to reproduce the issue?

Yes, with a real Azure OpenAI Responses resource; current main clearly passes the obsolete default into the SDK, and the PR body supplies redacted negative-control and after-fix output for that path.

Is this the best way to solve the issue?

Yes; changing only the Responses transport default to preview is the narrowest maintainable fix for the proven failure, and the final diff avoids the less-proven image-generation/docs changes from earlier revisions.

What I checked:

Likely related people:

  • steipete: Current-line blame in the checkout points to Peter Steinberger for the Azure default area, and GitHub history shows repeated recent OpenAI transport/test work in the central files. (role: recent area contributor; confidence: high; commits: 7e9a86342317, f3361dc92870, b9185703bc6a; files: src/agents/openai-transport-stream.ts, src/agents/openai-transport-stream.test.ts)
  • galiniliev: Recent GitHub history for the same transport files includes an Azure Responses stream-frame fix authored by Galin Iliev. (role: adjacent Azure Responses contributor; confidence: medium; commits: 4b28312bd8ec; files: src/agents/openai-transport-stream.ts, src/agents/openai-transport-stream.test.ts)
  • kunalk16: Prior merged work routed Azure custom providers through azure-openai-responses, making them a plausible reviewer for provider-level behavior even though this PR touches a different transport file. (role: adjacent provider contributor; confidence: low; commits: 34b0a19a164f; files: src/agents/pi-embedded-runner/openai-stream-wrappers.ts, src/config/types.models.ts)

Remaining risk / open question:

  • I did not independently rerun the live Azure call because it requires private Azure credentials; the review relies on source inspection, upstream contracts, and the contributor's redacted terminal proof.
  • At inspection time, a newly queued exact-head real-behavior-proof check was still in progress, so automerge should continue to let required checks and mergeability gate the head.

Codex review notes: model gpt-5.5, reasoning high; reviewed against be166b9ae48d.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS and removed size: L labels May 15, 2026
@leoge007

Copy link
Copy Markdown
Contributor Author

Updated the PR after the review.

What changed:

  • repaired the corrupt diff by restoring both affected files from the base tree and applying only the intended default-version change
  • changed the proposed default to preview, matching live Azure /openai/v1/responses behavior
  • updated transport tests, image-provider URL tests, and docs
  • added redacted live Azure proof to the PR body

Final PR diff is now the narrow 5-file change:

  • src/agents/openai-transport-stream.ts
  • extensions/openai/image-generation-provider.ts
  • src/agents/openai-transport-stream.test.ts
  • extensions/openai/image-generation-provider.test.ts
  • docs/providers/openai.md

@clawsweeper re-review

@leoge007 leoge007 changed the title fix: update DEFAULT_AZURE_OPENAI_API_VERSION to 2025-04-01-preview for Responses API support fix: update Azure OpenAI API version default to preview May 15, 2026
@clawsweeper

clawsweeper Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 15, 2026
@leoge007

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated the PR body to use the required ## Real behavior proof section and field names expected by the proof gate. CI is now 90 pass / 0 pending / 0 fail.

@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation extensions: openai labels May 15, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 15, 2026
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge label May 15, 2026
@clawsweeper

clawsweeper Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

🦞🔧
ClawSweeper saw the passing review, but the PR needs another repair pass before merge.

Source: clawsweeper[bot]
Feedback: structured ClawSweeper verdict: pass (sha=034cb56a0fba578dcda5fed59ce5a707c201d973); CHANGELOG.md entry is required before automerge; dispatch a focused changelog repair
Action: repair worker queued. Run: https://github.com/openclaw/clawsweeper/actions/runs/25907951685
Model: gpt-5.5

I will update this PR branch, or open a safe credited replacement, if the repair worker finds a narrow CI fix.

Automerge progress:

  • 2026-05-15 08:12:55 UTC review queued 034cb56a0fba (queued)
  • 2026-05-15 08:22:40 UTC review passed 034cb56a0fba (structured ClawSweeper verdict: pass (sha=034cb56a0fba578dcda5fed59ce5a707c201d...)

@clawsweeper

clawsweeper Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper 🐠 reef update

Thanks for the work on this. ClawSweeper opened a replacement PR only because the source branch was not writable from the available bot permissions. branch tides, not contributor blame.

Why replacement: ClawSweeper could not update the source PR branch directly; GitHub did not grant sufficient push rights to the bot for that branch.
Replacement PR: #82072
Why close: this run explicitly closes the superseded source PR after the credited replacement PR is open, so review continues in one place.
Closing this one because the run was configured to close superseded source PRs after opening the replacement.
Credit follows the fix over to the replacement PR. no sneaky treasure grab.
Co-author credit kept:

fish notes: model gpt-5.5, reasoning high; reviewed against d7062f1.

@clawsweeper clawsweeper Bot closed this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:automerge Maintainer opted this PR into bounded ClawSweeper-reviewed automerge proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants