UAT: Dedicated OpenAIChatProvider and AnthropicChatProvider classes exist but are never used by the provider registry #3427

Closed
opened 2026-04-05 16:40:43 +00:00 by freemo · 3 comments
Owner

Metadata

  • Branch: fix/backlog-openai-anthropic-provider-registry-integration
  • Commit Message: fix(providers): wire OpenAIChatProvider and AnthropicChatProvider into ProviderRegistry
  • Milestone: None (Backlog)
  • Parent Epic: #3365

Backlog note: This issue was discovered during autonomous operation
on milestone v3.6.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Background and Context

The codebase contains dedicated provider classes OpenAIChatProvider (in src/cleveragents/providers/llm/openai_provider.py) and AnthropicChatProvider (in src/cleveragents/providers/llm/anthropic_provider.py). These classes were presumably created to provide provider-specific behaviour and a consistent abstraction layer, consistent with how GoogleChatProvider and OpenRouterChatProvider are implemented and used.

However, ProviderRegistry.create_ai_provider() never instantiates these classes. For OpenAI and Anthropic provider types, execution falls through to the generic LangChainChatProvider factory pattern (lines 650–665 of registry.py). This leaves OpenAIChatProvider and AnthropicChatProvider as dead code in production — they are only referenced in test files.

This creates an architectural inconsistency: Google and OpenRouter have dedicated classes and are wired into the registry, while OpenAI and Anthropic have dedicated classes that are completely bypassed. Additionally, src/cleveragents/providers/llm/__init__.py is empty, meaning nothing is exported from the llm subpackage.

Current Behavior

ProviderRegistry.create_ai_provider() contains special-case handling only for ProviderType.GOOGLE (instantiates GoogleChatProvider) and ProviderType.OPENROUTER (instantiates OpenRouterChatProvider). For all other provider types — including ProviderType.OPENAI and ProviderType.ANTHROPIC — the method falls through to the generic LangChainChatProvider wrapper (lines 650–665).

As a result:

  • OpenAIChatProvider is referenced only in openai_provider.py itself and test files — never in production code.
  • AnthropicChatProvider is referenced only in anthropic_provider.py itself and test files — never in production code.
  • src/cleveragents/providers/llm/__init__.py exports nothing.

Expected Behavior

ProviderRegistry.create_ai_provider() should dispatch to OpenAIChatProvider when the provider type is ProviderType.OPENAI, and to AnthropicChatProvider when the provider type is ProviderType.ANTHROPIC, consistent with how GoogleChatProvider and OpenRouterChatProvider are already used. The llm subpackage __init__.py should export all four dedicated provider classes.

Code Locations

File Issue
src/cleveragents/providers/llm/openai_provider.py OpenAIChatProvider class — dead code in production
src/cleveragents/providers/llm/anthropic_provider.py AnthropicChatProvider class — dead code in production
src/cleveragents/providers/registry.py lines 554–665 create_ai_provider() bypasses dedicated classes for OpenAI and Anthropic
src/cleveragents/providers/llm/__init__.py Empty — no exports from the llm subpackage

Steps to Reproduce

  1. Search the entire codebase for OpenAIChatProvider — found only in openai_provider.py itself and test files, never in production registry code.
  2. Search for AnthropicChatProvider — found only in anthropic_provider.py itself and test files, never in production registry code.
  3. Read ProviderRegistry.create_ai_provider() in registry.py — no reference to either class; both provider types fall through to the generic LangChainChatProvider path.

Subtasks

  • Audit OpenAIChatProvider and AnthropicChatProvider to confirm they are functionally equivalent to (or a superset of) the generic LangChainChatProvider path for their respective provider types
  • Add ProviderType.OPENAI dispatch branch in create_ai_provider() to instantiate OpenAIChatProvider
  • Add ProviderType.ANTHROPIC dispatch branch in create_ai_provider() to instantiate AnthropicChatProvider
  • Update src/cleveragents/providers/llm/__init__.py to export OpenAIChatProvider, AnthropicChatProvider, GoogleChatProvider, and OpenRouterChatProvider
  • Ensure all existing unit and integration tests for OpenAI and Anthropic providers still pass
  • Add/update tests to assert that create_ai_provider() returns an OpenAIChatProvider instance for ProviderType.OPENAI
  • Add/update tests to assert that create_ai_provider() returns an AnthropicChatProvider instance for ProviderType.ANTHROPIC
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

  • All subtasks above are completed and checked off
  • ProviderRegistry.create_ai_provider() dispatches to OpenAIChatProvider for ProviderType.OPENAI and AnthropicChatProvider for ProviderType.ANTHROPIC
  • No dead code remains: both dedicated provider classes are used in production
  • src/cleveragents/providers/llm/__init__.py exports all four dedicated provider classes
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional details
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done
  • All nox stages pass
  • Coverage >= 97%

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-uat-tester

## Metadata - **Branch**: `fix/backlog-openai-anthropic-provider-registry-integration` - **Commit Message**: `fix(providers): wire OpenAIChatProvider and AnthropicChatProvider into ProviderRegistry` - **Milestone**: None (Backlog) - **Parent Epic**: #3365 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.6.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Background and Context The codebase contains dedicated provider classes `OpenAIChatProvider` (in `src/cleveragents/providers/llm/openai_provider.py`) and `AnthropicChatProvider` (in `src/cleveragents/providers/llm/anthropic_provider.py`). These classes were presumably created to provide provider-specific behaviour and a consistent abstraction layer, consistent with how `GoogleChatProvider` and `OpenRouterChatProvider` are implemented and used. However, `ProviderRegistry.create_ai_provider()` never instantiates these classes. For OpenAI and Anthropic provider types, execution falls through to the generic `LangChainChatProvider` factory pattern (lines 650–665 of `registry.py`). This leaves `OpenAIChatProvider` and `AnthropicChatProvider` as dead code in production — they are only referenced in test files. This creates an architectural inconsistency: Google and OpenRouter have dedicated classes **and** are wired into the registry, while OpenAI and Anthropic have dedicated classes that are completely bypassed. Additionally, `src/cleveragents/providers/llm/__init__.py` is empty, meaning nothing is exported from the `llm` subpackage. ## Current Behavior `ProviderRegistry.create_ai_provider()` contains special-case handling only for `ProviderType.GOOGLE` (instantiates `GoogleChatProvider`) and `ProviderType.OPENROUTER` (instantiates `OpenRouterChatProvider`). For all other provider types — including `ProviderType.OPENAI` and `ProviderType.ANTHROPIC` — the method falls through to the generic `LangChainChatProvider` wrapper (lines 650–665). As a result: - `OpenAIChatProvider` is referenced only in `openai_provider.py` itself and test files — never in production code. - `AnthropicChatProvider` is referenced only in `anthropic_provider.py` itself and test files — never in production code. - `src/cleveragents/providers/llm/__init__.py` exports nothing. ## Expected Behavior `ProviderRegistry.create_ai_provider()` should dispatch to `OpenAIChatProvider` when the provider type is `ProviderType.OPENAI`, and to `AnthropicChatProvider` when the provider type is `ProviderType.ANTHROPIC`, consistent with how `GoogleChatProvider` and `OpenRouterChatProvider` are already used. The `llm` subpackage `__init__.py` should export all four dedicated provider classes. ## Code Locations | File | Issue | |---|---| | `src/cleveragents/providers/llm/openai_provider.py` | `OpenAIChatProvider` class — dead code in production | | `src/cleveragents/providers/llm/anthropic_provider.py` | `AnthropicChatProvider` class — dead code in production | | `src/cleveragents/providers/registry.py` lines 554–665 | `create_ai_provider()` bypasses dedicated classes for OpenAI and Anthropic | | `src/cleveragents/providers/llm/__init__.py` | Empty — no exports from the `llm` subpackage | ## Steps to Reproduce 1. Search the entire codebase for `OpenAIChatProvider` — found only in `openai_provider.py` itself and test files, never in production registry code. 2. Search for `AnthropicChatProvider` — found only in `anthropic_provider.py` itself and test files, never in production registry code. 3. Read `ProviderRegistry.create_ai_provider()` in `registry.py` — no reference to either class; both provider types fall through to the generic `LangChainChatProvider` path. ## Subtasks - [ ] Audit `OpenAIChatProvider` and `AnthropicChatProvider` to confirm they are functionally equivalent to (or a superset of) the generic `LangChainChatProvider` path for their respective provider types - [ ] Add `ProviderType.OPENAI` dispatch branch in `create_ai_provider()` to instantiate `OpenAIChatProvider` - [ ] Add `ProviderType.ANTHROPIC` dispatch branch in `create_ai_provider()` to instantiate `AnthropicChatProvider` - [ ] Update `src/cleveragents/providers/llm/__init__.py` to export `OpenAIChatProvider`, `AnthropicChatProvider`, `GoogleChatProvider`, and `OpenRouterChatProvider` - [ ] Ensure all existing unit and integration tests for OpenAI and Anthropic providers still pass - [ ] Add/update tests to assert that `create_ai_provider()` returns an `OpenAIChatProvider` instance for `ProviderType.OPENAI` - [ ] Add/update tests to assert that `create_ai_provider()` returns an `AnthropicChatProvider` instance for `ProviderType.ANTHROPIC` - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done - [ ] All subtasks above are completed and checked off - [ ] `ProviderRegistry.create_ai_provider()` dispatches to `OpenAIChatProvider` for `ProviderType.OPENAI` and `AnthropicChatProvider` for `ProviderType.ANTHROPIC` - [ ] No dead code remains: both dedicated provider classes are used in production - [ ] `src/cleveragents/providers/llm/__init__.py` exports all four dedicated provider classes - [ ] A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional details - [ ] The commit is pushed to the remote on the branch matching the Branch in Metadata exactly - [ ] The commit is submitted as a pull request to `master`, reviewed, and merged before this issue is marked done - [ ] All nox stages pass - [ ] Coverage >= 97% --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-uat-tester
Author
Owner

PR #3464 created on branch fix/backlog-openai-anthropic-provider-registry-integration. I will monitor and handle all review feedback until merged.

Implementation summary:

  • Added ProviderType.OPENAI and ProviderType.ANTHROPIC dispatch branches in ProviderRegistry.create_ai_provider() — both now instantiate their dedicated provider classes instead of falling through to the generic LangChainChatProvider path
  • Updated src/cleveragents/providers/llm/__init__.py to export all four dedicated provider classes
  • Updated and added tests in features/provider_registry_coverage.feature and features/steps/provider_registry_steps.py
  • nox -s lint and nox -s typecheck both pass (0 errors)

Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

PR #3464 created on branch `fix/backlog-openai-anthropic-provider-registry-integration`. I will monitor and handle all review feedback until merged. **Implementation summary:** - Added `ProviderType.OPENAI` and `ProviderType.ANTHROPIC` dispatch branches in `ProviderRegistry.create_ai_provider()` — both now instantiate their dedicated provider classes instead of falling through to the generic `LangChainChatProvider` path - Updated `src/cleveragents/providers/llm/__init__.py` to export all four dedicated provider classes - Updated and added tests in `features/provider_registry_coverage.feature` and `features/steps/provider_registry_steps.py` - `nox -s lint` and `nox -s typecheck` both pass (0 errors) --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Author
Owner

PR #3464 Status Update

PR #3464 (fix(providers): wire OpenAIChatProvider and AnthropicChatProvider into ProviderRegistry) is ready for merge.

Current Status:

  • All CI checks passing (coverage, integration tests, e2e tests, docker, status-check)
  • Type/Bug label assigned
  • Milestone v3.2.0 assigned
  • PR is mergeable (no conflicts)
  • Bot self-review completed — no blocking issues found
  • Awaiting human approval to merge

The bot self-reviewer noted the implementation is clean, architecturally consistent, and well-tested. The only items flagged were process metadata (labels/milestone), which have since been addressed.

Awaiting: 1 approval from a human reviewer to proceed with merge.


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

## PR #3464 Status Update PR #3464 (`fix(providers): wire OpenAIChatProvider and AnthropicChatProvider into ProviderRegistry`) is ready for merge. **Current Status:** - ✅ All CI checks passing (coverage, integration tests, e2e tests, docker, status-check) - ✅ `Type/Bug` label assigned - ✅ Milestone `v3.2.0` assigned - ✅ PR is mergeable (no conflicts) - ✅ Bot self-review completed — no blocking issues found - ⏳ Awaiting human approval to merge The bot self-reviewer noted the implementation is clean, architecturally consistent, and well-tested. The only items flagged were process metadata (labels/milestone), which have since been addressed. **Awaiting:** 1 approval from a human reviewer to proceed with merge. --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Author
Owner

PR #3464 Merged Successfully

PR #3464 (fix(providers): wire OpenAIChatProvider and AnthropicChatProvider into ProviderRegistry) has been merged into master.

Merge Details:

  • Merged by: @freemo (Jeffrey Phillips Freeman)
  • Merged at: 2026-04-05T21:07:03Z
  • Merge commit: 2a48c508d6651a30776928a58e4a007a30e2cdca

Summary of what was delivered:

  • OpenAIChatProvider and AnthropicChatProvider are now properly wired into ProviderRegistry.create_ai_provider() — no longer dead code
  • src/cleveragents/providers/llm/__init__.py now exports all 4 dedicated provider classes
  • 3 new BDD test scenarios added (Anthropic dispatch, OpenAI missing-key error, Anthropic missing-key error)
  • 3 existing scenarios updated to reflect the new dispatch behavior
  • All CI checks passed: coverage, integration tests, e2e tests, docker, status-check

This issue is now resolved. 🎉


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: ca-issue-worker

## ✅ PR #3464 Merged Successfully PR #3464 (`fix(providers): wire OpenAIChatProvider and AnthropicChatProvider into ProviderRegistry`) has been merged into `master`. **Merge Details:** - Merged by: @freemo (Jeffrey Phillips Freeman) - Merged at: 2026-04-05T21:07:03Z - Merge commit: `2a48c508d6651a30776928a58e4a007a30e2cdca` **Summary of what was delivered:** - `OpenAIChatProvider` and `AnthropicChatProvider` are now properly wired into `ProviderRegistry.create_ai_provider()` — no longer dead code - `src/cleveragents/providers/llm/__init__.py` now exports all 4 dedicated provider classes - 3 new BDD test scenarios added (Anthropic dispatch, OpenAI missing-key error, Anthropic missing-key error) - 3 existing scenarios updated to reflect the new dispatch behavior - All CI checks passed: coverage, integration tests, e2e tests, docker, status-check This issue is now resolved. 🎉 --- **Automated by CleverAgents Bot** Supervisor: Implementation | Agent: ca-issue-worker
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#3427
No description provided.