Skip to content

fix(llms): use Authorization Bearer header in UiPathOpenAI#328

Open
ionmincu wants to merge 1 commit into
mainfrom
fix/uipath-openai-auth-bearer-header
Open

fix(llms): use Authorization Bearer header in UiPathOpenAI#328
ionmincu wants to merge 1 commit into
mainfrom
fix/uipath-openai-auth-bearer-header

Conversation

@ionmincu
Copy link
Copy Markdown
Collaborator

Summary

  • UiPathOpenAI was passing UIPATH_ACCESS_TOKEN as api_key= to AzureOpenAI. The OpenAI SDK emits that as the Azure-style api-key: header, but AgentHub's LLMProxy [Authorize] pipeline (JwtBearer + S2S schemes) only reads Authorization: Bearer. The request arrived with no Authorization header and was rejected anonymously → 401.
  • App Insights (prd-ne, ahub-prd-global-ne-ais) confirms every 401 on POST LLMProxy/RawVendorCompletionsAsync for the openai path has Auth.HasAuthorizationHeader: false, no JWT.* claims, no upstream dependency emitted — i.e. rejected at AgentHub auth, never reaching LLM Gateway. Same caller succeeded on vertexai 19s before with HasAuthorizationHeader: true.
  • The fix mirrors what UiPathChatBedrock/UiPathChatBedrockConverse (bedrock.py:127-131) and UiPathVertex (vertex.py:247-256) already do: attach Authorization: Bearer <UIPATH_ACCESS_TOKEN> in default_headers. A placeholder api_key="uipath-gateway" keeps the AzureOpenAI constructor happy.

Test plan

  • CI uipath-llamaindex/chat-models / staging (UiPathOpenAI) — 10 methods flip from 401 to ✓
  • CI uipath-llamaindex/quickstart-agent / cloud — passes
  • CI uipath-llamaindex/simple-hitl-agent / staging and / cloud — pass
  • App Insights spot-check: a dependencies row to LLM Gateway now appears for these operation_Ids (proves auth passed)
  • UiPathChatBedrockConverse, UiPathChatBedrock, UiPathVertex keep passing (unaffected)

Note on out-of-scope CI failures

The */alpha matrix cells (debug-breakpoints / alpha, quickstart-agent / alpha, simple-hitl-agent / alpha) fail before any LLM call with ❌ Failed to get tenants and organizations: — separate alpha-env credential issue, not addressed here.

🤖 Generated with Claude Code

…hOpenAI

AzureOpenAI emits the api_key argument as the Azure-style `api-key` header,
which AgentHub's LLMProxy [Authorize] pipeline (JwtBearer/S2S schemes) does
not read, resulting in 401 with no Authorization header on the request.
Bedrock and Vertex wrappers already attach `Authorization: Bearer <token>`
explicitly; align UiPathOpenAI by setting it in default_headers and passing
a placeholder api_key to satisfy the AzureOpenAI constructor.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@ionmincu ionmincu force-pushed the fix/uipath-openai-auth-bearer-header branch from a163f50 to 4d428d4 Compare May 11, 2026 15:00
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 90%)

See analysis details on SonarQube Cloud

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.

1 participant