Skip to content

fix: route Azure Astra through Responses API - #15845

Open
usnavy13 wants to merge 4 commits into
danny-avila:devfrom
usnavy13:fix/azure-astra-responses
Open

fix: route Azure Astra through Responses API#15845
usnavy13 wants to merge 4 commits into
danny-avila:devfrom
usnavy13:fix/azure-astra-responses

Conversation

@usnavy13

@usnavy13 usnavy13 commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Azure OpenAI agents using gpt-6-astra fail with a 400 when they call a function tool unless the user manually enables the Responses API. Astra support in #15567 limited automatic routing and SDK request constraints to canonical OpenAI endpoints. Azure now receives the same Responses default, with the correct URL and deployment name, and compaction resolves the configured summary model's deployment and credentials.

Fixes #15844.

How it works

Recognize direct Azure OpenAI configurations and canonical Azure hosts, resolving URL placeholders before checking the host. Normalize bare resource URLs to the API path, recover deployments specified only in a URL, and move query parameters into the SDK's query options so it can append /responses correctly. Explicit API opt-outs, custom gateway routing, and Azure's fallback model selection remain intact.

Azure configuration: gpt-6-astra -> production-deployment
  getOpenAILLMConfig
    useResponsesApi: true -> max_output_tokens
    model: gpt-6-astra -> existing SDK request constraints
    modelKwargs.model: production-deployment -> Azure request body
  getOpenAIConfig -> /openai/v1/responses + api-key header

Compaction: gpt-4.1-mini -> summary-production
  shapeSummarizationConfig
    mapModelToAzureConfig -> summary group's resource, key and deployment
    getOpenAIConfig -> target model's API and request parameters
  SDK summarizer -> summary-production

The logical Astra model remains available to the SDK for parameter validation and encrypted reasoning, while the request carries Azure's deployment name. A different summary model resolves through Azure's existing model/group maps; self-summarization keeps the agent's resolved options. No SDK dependency update or new configuration field is required.

Azure's support table lists Astra function calling as Responses-only. Chat Completions remains available without tools; tools are attached after configuration, so the default is chosen at configuration time.

Change Type

  • Bug fix

Testing

  • 516 tests passed across nine suites: OpenAI endpoint configuration and initialization, Azure utilities, SDK requests, and summarization.
  • Request tests use the real agents SDK with an HTTP substitute and assert the final URL, query parameters, API key header, deployment, token limit, tool schema, and Astra parameter constraints. Coverage includes bare origins, trailing slashes, URL templates, deployments specified only in the URL, and the v1 model-name fallback.
  • Compaction tests execute the real SDK graph with an HTTP substitute. They verify a separate deployment on the same resource, a different resource/key, and a versioned Astra summary model, while keeping the main agent's configuration intact.
  • npx tsc --noEmit passed in packages/api; packages/data-provider also passed for the original comment-only change. ESLint, formatting, import sorting, and pre-commit static checks passed.
  • Manual Azure smoke test of automatic routing: an agent with calculator, reasoning_effort: low, and no useResponsesApi setting returned 4 for 2 + 2; after reloading, it called the calculator again and returned 12. The subsequent URL and compaction changes are covered by the SDK tests above.
  • npm run lighthouse completed the production build, but the local audit failed during Chrome's temporary-profile cleanup with Windows EPERM. Lighthouse CI passed on the previous reviewed commit; the updated commit needs its own CI result.

Checklist

  • Code follows the project's style guidelines.
  • Self-review completed.
  • Regression tests cover the reported behavior.
  • Focused local tests and workspace typechecks pass.

usnavy13 and others added 2 commits September 11, 2026 17:56
The Azure deployment alias in `modelKwargs.model` is spread after `model`
by langchain, so the SDK's same-provider summarizer, which copies the
agent's client options and overrides only `model`, still reached the Astra
deployment when configured with a different model. Hand the summarizer the
agent's kwargs without the alias whenever its model differs.

Also derive the Astra routing decision once, reuse the first-party OpenAI
predicate in the GPT-5.6 rule, pin the opt-out shape in the Azure spec, and
expect `firstPartyEndpoint` for canonical Azure hosts in the backward-compat
spec.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Repository owner deleted a comment from chatgpt-codex-connector Bot Sep 12, 2026
@danny-avila

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-12T01:38:42.907772Z 4237cd7 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4237cd72ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/endpoints/openai/llm.ts Outdated
Comment thread packages/api/src/agents/run.ts
Comment thread packages/api/src/endpoints/openai/llm.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants