Fix Azure Foundry Anthropic strict tools#4682
Open
roboomp wants to merge 1 commit into
Open
Conversation
Azure Foundry Anthropic routes reject Anthropic structured-output strict tooling for Sonnet 5 utility requests. Detect Azure Anthropic hosts as strict-tool-incompatible, gate the structured-output beta when strict tools are disabled, and cover the utility header plus tool-schema contracts. Fixes #4679
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Collaborator
Author
|
No code change requested by the Codex quota notice. PR #4682 remains ready for maintainer review; repo admins need to enable Codex review credits if they want the automated review to run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repro
Azure Foundry Anthropic Sonnet 5 utility requests fail with
400 structured_outputs not supported in your workspacebecause the route receives Anthropic strict-tool structured-output framing. Reproduced withbun test packages/ai/test/issue-4679-repro.test.tsbefore the fix: Azure Foundry Anthropic compat resolveddisableStrictToolsasfalse.Cause
packages/catalog/src/compat/anthropic.tsrecognized Azure AI Inference / Foundry Anthropic URLs as signing endpoints but still setResolvedAnthropicCompat.disableStrictToolstofalse.packages/ai/src/providers/anthropic.tsthen built OAuth utility headers throughbuildClaudeCodeBetaswithout considering strict-tool disablement, sostructured-outputs-2025-12-15remained inanthropic-betaeven when strict tools were intended to be removed.Fix
buildAnthropicCompat.disableStrictToolsinto Anthropic client option/header construction.structured-outputs-2025-12-15from Claude Code OAuth beta defaults when strict tools are disabled.Verification
Focused tests passed:
bun test packages/ai/test/issue-4679-repro.test.ts(4 pass, 10 assertions),bun test packages/ai/test/issue-826-repro.test.ts(4 pass, 7 assertions), andbun test packages/catalog/test/issue-4297-repro.test.ts(10 pass, 22 assertions).gh_push_branchalso completed its pre-publish gate and pushedfarm/d5df12c6/sonnet-5-azure-foundry. Fixes #4679