Skip to content

fix(chat): route OAuth backend through native provider#542

Open
thakrarsagar wants to merge 1 commit into
HKUDS:devfrom
thakrarsagar:fix/chat-oauth-native-provider
Open

fix(chat): route OAuth backend through native provider#542
thakrarsagar wants to merge 1 commit into
HKUDS:devfrom
thakrarsagar:fix/chat-oauth-native-provider

Conversation

@thakrarsagar

Copy link
Copy Markdown

Description

Fixes chat failures for the OAuth-backed LLM profile in the agentic client factory.

The provider registry already identifies this profile as a native OAuth backend, and the runtime provider factory routes it through the dedicated native provider. The agentic chat client factory missed that routing branch and fell through to a generic AsyncOpenAI client instead. With the Settings base URL set to https://chatgpt.com/backend-api, the Python backend attempted a generic chat-completions request and received an HTML browser challenge where JSON was expected.

This change routes that backend through the existing OpenAI-style adapter backed by the native provider, matching the routing used by the general LLM runtime.

Related Issues

N/A (no existing issue found)

Module(s) Affected

  • agents
  • api
  • config
  • core
  • knowledge
  • logging
  • services
  • tools
  • utils
  • web (Frontend)
  • docs (Documentation)
  • scripts
  • tests
  • Other: ...

Checklist

  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary).
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

Root cause: build_openai_client() only special-cased the Anthropic backend before constructing a generic OpenAI-compatible SDK client. Native OAuth-backed chat needs the existing native provider path instead.

Files changed:

  • deeptutor/core/agentic/client.py
  • tests/core/test_agentic_client_provider_kwargs.py

Validation:

  • uv run --with pytest --with pytest-asyncio pytest tests/core/test_agentic_client_provider_kwargs.py -q — 12 passed
  • uv run --with pre-commit pre-commit run --files deeptutor/core/agentic/client.py tests/core/test_agentic_client_provider_kwargs.py — passed

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