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

Closed
HAL9000 wants to merge 3 commits from bugfix/m6-gemini-fallback-order into master
8 changed files with 27 additions and 7 deletions
+10
View File
4
@@ -369,6 +369,16 @@ ensuring data is stored with proper parameter values.
- **BDD Feature File Tag Coverage** (#9124): Added required `@a2a`, `@session`, and `@cli` Gherkin tags to all A2A, session, and CLI feature files (30 files) to enable tag-based test filtering via `behave --tags=a2a,session,cli`. This restores the ability to selectively run test categories and enables CI to execute targeted test suites without running the full suite.
- **ProviderType.GEMINI missing from ProviderRegistry.FALLBACK_ORDER** (#10906, #4750):
Added `ProviderType.GEMINI` to both `ProviderRegistry.FALLBACK_ORDER` (after
`ProviderType.GOOGLE`) and `FallbackSelector.DEFAULT_FALLBACK_ORDER` (after
`"google"`). The GEMINI enum value, capabilities, default model, and API key mapping
were already defined in the registry but Gemini-only users could not get a provider
via the fallback chain — `get_default_provider_type()` returned ``None`` when only
``GEMINI_API_KEY`` was set. Also removed the ``@tdd_expected_fail`` tag from the
Behave regression test (`features/tdd_gemini_fallback_order_4750.feature`) since the
bug is now resolved and the test must pass normally.
- **Cross-actor subgraph cycle detection reads actor_ref field** (#1431): Fixed
`_detect_subgraph_cycles()`, `_map_node()`, and the `compile_actor()` main loop
in `src/cleveragents/actor/compiler.py` to read `actor_ref` from the top-level
+1
View File
1
@@ -103,3 +103,4 @@ Below are some specific details of individual PR contributions.
* HAL 9000 has contributed the resource and skill management showcase alignment (#4213): updated the CLI tools showcase with consistent counts, explicit save instructions, metadata callouts, and README framing for platform walkthroughs; removed obsolete tdd_issue tags from coverage threshold Robot tests; hardened the Skip If No LLM Keys E2E helper with per-key regex validation and log suppression to prevent credential leakage.
* HAL 9000 has contributed the sandbox dirs cache invalidation fix (PR #11091 / issue #7527): introduced `SandboxDirsCache` to track filesystem paths of sandbox-created directories by plan_id, wired automatic invalidation into all cleanup/purge methods (`cleanup_all`, `cleanup_abandoned`, `clear_sandbox_dirs_cache`, `_cleanup_on_exit_handler`), and added BDD test coverage.
* HAL 9000 has contributed the CleanupService sandbox cache invalidation fix (PR #8257 / issue #7527): `_purge_sandboxes()` now invalidates the internal `_sandbox_dirs_cache` after deleting stale directories so that a subsequent `scan()` call on the same instance re-reads the filesystem instead of returning already-deleted paths as stale items.
* HAL 9000 has contributed the ProviderType.GEMINI fallback order fix (PR #10906 / issue #4750): added GEMINI to both ProviderRegistry.FALLBACK_ORDER and FallbackSelector.DEFAULT_FALLBACK_ORDER so Gemini-only users can get a default provider via the fallback chain, and converted the TDD @tdd_expected_fail regression test to a permanent guard.
1
@@ -508,6 +508,7 @@ Feature: Provider Registry Coverage
Then OpenAI should be first in the order
And Anthropic should be second in the order
And Google should be third in the order
And Gemini should be fourth in the order
@unit @providers @registry
Scenario: Default models for all providers
1
@@ -992,6 +992,11 @@ def step_impl_google_third(context: Any) -> None:
assert context.fallback_order[2] == _ensure_provider_type(context).GOOGLE
@then("Gemini should be fourth in the order")
def step_impl_gemini_fourth(context: Any) -> None:
assert context.fallback_order[3] == _ensure_provider_type(context).GEMINI
@then('{provider} default should be "{model}"')
def step_impl_default_models(context: Any, provider: str, model: str) -> None:
provider_enum = _ensure_provider_type(context)
@@ -2,14 +2,15 @@
Issue: #4750 — ProviderType.GEMINI missing from ProviderRegistry.FALLBACK_ORDER
TDD Issue: #10896
Fixed by: PR #10906
This test captures the bug: when only GEMINI_API_KEY is set (without GOOGLE_API_KEY),
get_default_provider_type() returns None instead of ProviderType.GEMINI because
GEMINI is absent from FALLBACK_ORDER.
This test captures the regression that was fixed when ProviderType.GEMINI was added
to both ProviderRegistry.FALLBACK_ORDER and FallbackSelector.DEFAULT_FALLBACK_ORDER.
Previously, get_default_provider_type() returned None instead of ProviderType.GEMINI
when only GEMINI_API_KEY was set (without GOOGLE_API_KEY) because GEMINI was absent
from FALLBACK_ORDER.
The @tdd_expected_fail tag inverts the result so CI passes while the bug exists.
Once the fix is applied (adding ProviderType.GEMINI to FALLBACK_ORDER), the
@tdd_expected_fail tag must be removed and the test must pass normally.
The @tdd_expected_fail tag has been removed this is now a permanent regression guard.
"""
from __future__ import annotations
@@ -3,7 +3,7 @@ Feature: TDD: ProviderType.GEMINI missing from ProviderRegistry.FALLBACK_ORDER
I want get_default_provider_type() to return ProviderType.GEMINI via the fallback chain
So that Gemini-only users can use auto-discovery without setting GOOGLE_API_KEY
@tdd_issue @tdd_issue_4750 @tdd_expected_fail
@tdd_issue @tdd_issue_4750
Scenario: Gemini-only user gets GEMINI as default provider via fallback order
Given a ProviderRegistry configured with only gemini_api_key set
And CLEVERAGENTS_DEFAULT_PROVIDER is not set for tdd test
@@ -65,6 +65,7 @@ class FallbackSelector:
"openai",
"anthropic",
"google",
"gemini",
"azure",
"openrouter",
"groq",
+1
View File
1
@@ -221,6 +221,7 @@ class ProviderRegistry:
ProviderType.OPENAI,
ProviderType.ANTHROPIC,
ProviderType.GOOGLE,
ProviderType.GEMINI,
ProviderType.AZURE,
ProviderType.OPENROUTER,
ProviderType.GROQ,