Bug: Codex TUI does not render assistant messages for Azure Chat Completions (APIM), despite successful SSE and output
Resolved 💬 1 comment Opened Aug 11, 2025 by santiago-afonso Closed Aug 11, 2025
What version of Codex is running?
codex-cli 0.20.0
Which model were you using?
gpt-5
What platform is your computer?
Linux 6.6.87.1-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
Bug: Codex TUI does not render assistant messages for Azure Chat Completions (APIM), despite successful SSE and output
Scope: Codex CLI v0.20 TUI
Symptom: The TUI accepts input but renders no assistant reply. Logs show a successful streamed completion and an Output item being emitted. This appears to be a render-only defect.
Environment
- Codex CLI: v0.20 (x86\_64 musl build)
- OS: Linux x86\_64
- Terminal: standard POSIX terminal (e.g.,
xterm-256color) - Auth: Entra ID (client credentials) → JWT in
Authorization: Bearer … - Backend: Azure OpenAI via APIM (exact host/deployment redacted)
Minimal configuration (redacted)
# ~/.codex/config.toml
projects = { "/path/to/project" = { trust_level = "trusted" } }
[model_providers.your-org]
name = "Azure"
base_url = "<APIM_BASE>/openai/deployments/<DEPLOYMENT>"
wire_api = "chat"
requires_openai_auth = false
env_key = "AZURE_OPENAI_API_KEY"
# ensure Bearer header
env_http_headers = { "Authorization" = "Bearer ${AZURE_OPENAI_API_KEY}" }
query_params = { "api-version" = "<API_VERSION>" }
[profiles.az-qa]
model_provider = "your-org"
model = "gpt-5"
Reproduction steps
- Obtain a valid Entra ID access token with the correct audience and set:
``bash``
export AZURE_OPENAI_API_KEY="<JWT>"
- Run Codex TUI:
``bash``
codex --profile az-qa -m gpt-5 "say hello"
- Observe: the TUI shows no assistant message after submitting the prompt (no error displayed).
Expected behavior
- TUI should render streamed tokens and the final assistant message in the chat pane.
Actual behavior
- TUI does not display any assistant content. However, logs confirm successful request/response flow and an emitted output message.
Evidence (sanitized logs)
DEBUG Configuring session: model=gpt-5; provider=ModelProviderInfo {
name: "Azure",
base_url: Some("<APIM_BASE>/openai/deployments/<DEPLOYMENT>"),
wire_api: Chat,
query_params: Some({"api-version": "<API_VERSION>"}),
requires_openai_auth: false,
env_http_headers: Some({"Authorization": "Bearer ${AZURE_OPENAI_API_KEY}"})
}
DEBUG POST to <APIM_BASE>/openai/deployments/<DEPLOYMENT>/chat/completions?api-version=<API_VERSION>: {
"model":"gpt-5",
"messages":[ ... ],
"stream":true,
"tools":[ ... ]
}
# (SSE chunks omitted for brevity)
DEBUG Output item item=Message {
role: "assistant",
content: [OutputText { text: "Hello! How can I help today?" }]
}
DEBUG Turn completed
Notes
- Control tests succeed:
curlto the same deploymented URL → 200 OK- AzureOpenAI Python SDK → 200 OK
- Codex transport/auth are fine; only the TUI fails to paint the already-produced assistant output.
- No OpenAI key/env fallback involved (
requires_openai_auth=false, explicit Bearer header).
Requested fix / investigation
- TUI should render the assistant message when an
Output itemis emitted for Azure Chat Completions (streaming). - Suspect: alt-screen repaint or post-stream flush path not triggered for the Azure provider route, even though the message is delivered to the output pipeline.
Additional info
- If needed, I can provide a full
RUST_LOG=traceexcerpt privately with host/deployment redacted. - I can also test a patched build to confirm the repaint path.
---
See also https://github.com/openai/codex/issues/2025 and https://github.com/openai/codex/issues/2024
What is the expected behavior?
_No response_
What do you see instead?
_No response_
Additional information
_No response_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗