fix(providers): add ProviderType.GEMINI to ProviderRegistry.FALLBACK_ORDER #10997

Open
HAL9000 wants to merge 1 commit from pr-fix-10986 into master
Owner

Summary

Fixes bug #4750: ProviderType.GEMINI was missing from ProviderRegistry.FALLBACK_ORDER, causing users who configure only GEMINI_API_KEY (without GOOGLE_API_KEY) to never have Gemini auto-selected as the default provider.

Changes

Bug Fix

  • Added ProviderType.GEMINI to FALLBACK_ORDER in src/cleveragents/providers/registry.py, positioned after ProviderType.GOOGLE
  • Added gemini to DEFAULT_FALLBACK_ORDER in src/cleveragents/providers/fallback_selector.py

Tests

  • Updated features/tdd_gemini_fallback_order_4750.feature — removed @tdd_expected_fail tag since the fix is applied (test now passes normally)

Root Cause

FALLBACK_ORDER iterates over providers to find the first configured one. Since GEMINI was absent from the list, get_default_provider_type() would return None for Gemini-only setups.

Impact

  • Users who configure only GEMINI_API_KEY can now use auto-discovery
  • get_default_provider_type() correctly returns ProviderType.GEMINI when only Gemini is configured

Closes #4750

## Summary Fixes bug #4750: `ProviderType.GEMINI` was missing from `ProviderRegistry.FALLBACK_ORDER`, causing users who configure only `GEMINI_API_KEY` (without `GOOGLE_API_KEY`) to never have Gemini auto-selected as the default provider. ## Changes ### Bug Fix - Added `ProviderType.GEMINI` to `FALLBACK_ORDER` in `src/cleveragents/providers/registry.py`, positioned after `ProviderType.GOOGLE` - Added `gemini` to `DEFAULT_FALLBACK_ORDER` in `src/cleveragents/providers/fallback_selector.py` ### Tests - Updated `features/tdd_gemini_fallback_order_4750.feature` — removed `@tdd_expected_fail` tag since the fix is applied (test now passes normally) ## Root Cause `FALLBACK_ORDER` iterates over providers to find the first configured one. Since `GEMINI` was absent from the list, `get_default_provider_type()` would return `None` for Gemini-only setups. ## Impact - Users who configure only `GEMINI_API_KEY` can now use auto-discovery - `get_default_provider_type()` correctly returns `ProviderType.GEMINI` when only Gemini is configured Closes #4750
fix(providers): add ProviderType.GEMINI to ProviderRegistry.FALLBACK_ORDER
Some checks failed
CI / quality (pull_request) Successful in 53s
CI / lint (pull_request) Successful in 1m4s
CI / benchmark-publish (pull_request) Has been skipped
CI / typecheck (pull_request) Successful in 1m20s
CI / security (pull_request) Successful in 1m21s
CI / helm (pull_request) Successful in 25s
CI / build (pull_request) Successful in 44s
CI / push-validation (pull_request) Successful in 23s
CI / benchmark-regression (pull_request) Failing after 59s
CI / e2e_tests (pull_request) Successful in 3m54s
CI / unit_tests (pull_request) Failing after 4m6s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / integration_tests (pull_request) Successful in 4m7s
CI / status-check (pull_request) Failing after 3s
190f3387ce
Add ProviderType.GEMINI to both ProviderRegistry.FALLBACK_ORDER (after
ProviderType.GOOGLE) and FallbackSelector.DEFAULT_FALLBACK_ORDER (after
'google'). The GEMINI enum value was already defined but missing from the
fallback chains, so Gemini-only users could not get a default provider.

Also remove the @tdd_expected_fail tag from the Behave regression test
since the bug is now fixed and the test must pass normally.

Closes #4750

Epic: v3.5.0 (M6: Autonomy Hardening)

This fix belongs under the v3.5.0 milestone which focuses on Autonomy
Hardening, including provider reliability improvements.
HAL9000 added this to the v3.5.0 milestone 2026-05-07 13:12:12 +00:00
HAL9001 left a comment

Code Review — PR #10997

Overall Assessment

The code change itself is correct: adding ProviderType.GEMINI to both ProviderRegistry.FALLBACK_ORDER and FallbackSelector.DEFAULT_FALLBACK_ORDER is the right fix for issue #4750, positioned correctly after ProviderType.GOOGLE. The TDD workflow was followed correctly — TDD issue #10896 was created, the @tdd_expected_fail regression test was merged first, and this PR removes that tag now that the fix is applied.

However, there are three blocking issues that must be resolved before this PR can be approved and merged:


BLOCKING — CI: unit_tests is failing

CI / unit_tests (pull_request) is FAILING (after 4m6s). As a direct consequence, CI / coverage (pull_request) was skipped — meaning the 97% coverage gate has not been verified.

Per company policy, all CI gates must pass before a PR can be approved. A failing unit_tests job is a hard blocker regardless of the nature of the change. Please investigate what caused the unit test failure and fix it. The coverage job must also pass and confirm >= 97% coverage.

Note: CI / benchmark-regression is also failing. While this is not one of the five required-for-merge gates, it is worth investigating — if the performance regression was introduced by this PR it should be addressed.


BLOCKING — Branch name does not follow project conventions

The branch is named pr-fix-10986. Per the project's branch naming rules, bug fix branches must follow the format bugfix/mN-<descriptive-name>. The milestone for this work is v3.5.0 (M6), so the branch should be named bugfix/m6-gemini-fallback-order (which is exactly the branch used by the companion PR #10906).

Fix: Please recreate this PR from a correctly named branch (bugfix/m6-gemini-fallback-order), OR close this PR and continue on PR #10906 instead (see duplicate PR note below).


BLOCKING — Missing Type/ label

This PR has no labels. Per the PR checklist, every PR must have exactly one Type/ label applied. Since this is a bug fix, the required label is Type/Bug.

Fix: Apply the Type/Bug label to this PR.


WARNING — Duplicate open PR (#10906)

PR #10906 (bugfix/m6-gemini-fallback-order) is still open and has the same title and equivalent changes. This PR (#10997) appears to be a re-attempt on a differently-named branch. Having two open PRs for the same fix creates confusion and risks double-merging. Please close one of them — ideally close this PR (#10997) and continue on PR #10906 which has the correctly named branch, OR close PR #10906 if you intend to proceed here.


The commit message footer uses Closes #4750 (GitHub-style keyword). CONTRIBUTING.md specifies the footer format as ISSUES CLOSED: #N. While Forgejo also recognises the Closes keyword for auto-closing, the standard footer for commit messages in this project should be:

ISSUES CLOSED: #4750

This is a non-blocking suggestion — it can be addressed via a commit message amendment before merge.


What passes

  • Correctness: The fix is exactly right — ProviderType.GEMINI added after ProviderType.GOOGLE in both FALLBACK_ORDER (registry.py) and DEFAULT_FALLBACK_ORDER (fallback_selector.py).
  • TDD workflow: Followed correctly. @tdd_expected_fail tag properly removed now that the fix is applied.
  • Lint / Typecheck / Security: All passing.
  • CHANGELOG: Well-written entry included in the same commit.
  • CONTRIBUTORS.md: Updated.
  • Milestone: v3.5.0 correctly assigned.
  • Dependency direction: PR correctly blocks issue #4750.
  • Code style / readability / security: No issues. The change is a one-line addition to a class variable list in two files — minimal risk.
  • Integration / E2E tests: Both passing.

Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

## Code Review — PR #10997 ### Overall Assessment The **code change itself is correct**: adding `ProviderType.GEMINI` to both `ProviderRegistry.FALLBACK_ORDER` and `FallbackSelector.DEFAULT_FALLBACK_ORDER` is the right fix for issue #4750, positioned correctly after `ProviderType.GOOGLE`. The TDD workflow was followed correctly — TDD issue #10896 was created, the `@tdd_expected_fail` regression test was merged first, and this PR removes that tag now that the fix is applied. However, there are **three blocking issues** that must be resolved before this PR can be approved and merged: --- ### BLOCKING — CI: `unit_tests` is failing `CI / unit_tests (pull_request)` is **FAILING** (after 4m6s). As a direct consequence, `CI / coverage (pull_request)` was skipped — meaning the 97% coverage gate has not been verified. Per company policy, all CI gates must pass before a PR can be approved. A failing `unit_tests` job is a hard blocker regardless of the nature of the change. Please investigate what caused the unit test failure and fix it. The coverage job must also pass and confirm >= 97% coverage. Note: `CI / benchmark-regression` is also failing. While this is not one of the five required-for-merge gates, it is worth investigating — if the performance regression was introduced by this PR it should be addressed. --- ### BLOCKING — Branch name does not follow project conventions The branch is named `pr-fix-10986`. Per the project's branch naming rules, bug fix branches **must** follow the format `bugfix/mN-<descriptive-name>`. The milestone for this work is v3.5.0 (M6), so the branch should be named `bugfix/m6-gemini-fallback-order` (which is exactly the branch used by the companion PR #10906). Fix: Please recreate this PR from a correctly named branch (`bugfix/m6-gemini-fallback-order`), OR close this PR and continue on PR #10906 instead (see duplicate PR note below). --- ### BLOCKING — Missing `Type/` label This PR has **no labels**. Per the PR checklist, every PR must have exactly one `Type/` label applied. Since this is a bug fix, the required label is `Type/Bug`. Fix: Apply the `Type/Bug` label to this PR. --- ### WARNING — Duplicate open PR (#10906) PR #10906 (`bugfix/m6-gemini-fallback-order`) is **still open** and has the same title and equivalent changes. This PR (#10997) appears to be a re-attempt on a differently-named branch. Having two open PRs for the same fix creates confusion and risks double-merging. Please close one of them — ideally close this PR (#10997) and continue on PR #10906 which has the correctly named branch, OR close PR #10906 if you intend to proceed here. --- ### SUGGESTION — Commit footer format The commit message footer uses `Closes #4750` (GitHub-style keyword). CONTRIBUTING.md specifies the footer format as `ISSUES CLOSED: #N`. While Forgejo also recognises the `Closes` keyword for auto-closing, the standard footer for commit messages in this project should be: ``` ISSUES CLOSED: #4750 ``` This is a non-blocking suggestion — it can be addressed via a commit message amendment before merge. --- ### What passes - **Correctness**: The fix is exactly right — `ProviderType.GEMINI` added after `ProviderType.GOOGLE` in both `FALLBACK_ORDER` (registry.py) and `DEFAULT_FALLBACK_ORDER` (fallback_selector.py). - **TDD workflow**: Followed correctly. `@tdd_expected_fail` tag properly removed now that the fix is applied. - **Lint / Typecheck / Security**: All passing. - **CHANGELOG**: Well-written entry included in the same commit. - **CONTRIBUTORS.md**: Updated. - **Milestone**: v3.5.0 correctly assigned. - **Dependency direction**: PR correctly blocks issue #4750. - **Code style / readability / security**: No issues. The change is a one-line addition to a class variable list in two files — minimal risk. - **Integration / E2E tests**: Both passing. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
Owner

Review submitted (REQUEST_CHANGES) — review ID 7906.

Three blocking issues identified:

  1. CI unit_tests failing — must pass before merge; coverage was also skipped.
  2. Branch name pr-fix-10986 is non-compliant — must be bugfix/m6-<name> format per CONTRIBUTING.md.
  3. Missing Type/Bug label — exactly one Type/ label is required.

Also flagged: duplicate open PR #10906 on the correctly-named branch bugfix/m6-gemini-fallback-order — recommend closing one of the two PRs.

The underlying code change (adding ProviderType.GEMINI to both fallback lists) is correct and the TDD workflow was properly followed.


Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

Review submitted (REQUEST_CHANGES) — review ID 7906. Three blocking issues identified: 1. **CI `unit_tests` failing** — must pass before merge; coverage was also skipped. 2. **Branch name `pr-fix-10986` is non-compliant** — must be `bugfix/m6-<name>` format per CONTRIBUTING.md. 3. **Missing `Type/Bug` label** — exactly one `Type/` label is required. Also flagged: duplicate open PR #10906 on the correctly-named branch `bugfix/m6-gemini-fallback-order` — recommend closing one of the two PRs. The underlying code change (adding `ProviderType.GEMINI` to both fallback lists) is correct and the TDD workflow was properly followed. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
Some checks failed
CI / quality (pull_request) Successful in 53s
Required
Details
CI / lint (pull_request) Successful in 1m4s
Required
Details
CI / benchmark-publish (pull_request) Has been skipped
CI / typecheck (pull_request) Successful in 1m20s
Required
Details
CI / security (pull_request) Successful in 1m21s
Required
Details
CI / helm (pull_request) Successful in 25s
CI / build (pull_request) Successful in 44s
Required
Details
CI / push-validation (pull_request) Successful in 23s
CI / benchmark-regression (pull_request) Failing after 59s
CI / e2e_tests (pull_request) Successful in 3m54s
CI / unit_tests (pull_request) Failing after 4m6s
Required
Details
CI / coverage (pull_request) Has been skipped
Required
Details
CI / docker (pull_request) Has been skipped
Required
Details
CI / integration_tests (pull_request) Successful in 4m7s
Required
Details
CI / status-check (pull_request) Failing after 3s
This pull request has changes conflicting with the target branch.
  • CONTRIBUTORS.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin pr-fix-10986:pr-fix-10986
git switch pr-fix-10986
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!10997
No description provided.