Skip to content

Fix Gemini/Google provider type mismatch and centralize provider types#595

Open
arn0ld87 wants to merge 2 commits into
mainfrom
fix/gemini-provider-mismatch-10704287634959598085
Open

Fix Gemini/Google provider type mismatch and centralize provider types#595
arn0ld87 wants to merge 2 commits into
mainfrom
fix/gemini-provider-mismatch-10704287634959598085

Conversation

@arn0ld87
Copy link
Copy Markdown
Owner

Unify Gemini/Google provider type across the backend to fix visibility issues of Gemini secrets and models. Introduced centralized provider types and a regression gate.

Fixes #575


PR created automatically by Jules for task 10704287634959598085 started by @arn0ld87

- Fixed `llm_profiles_store.py` to bootstrap Gemini profiles with provider="google".
- Introduced `backend/app/contracts/provider_types.py` with `ProviderType` Literal and constants.
- Updated all Pydantic models and service logic to use the new centralized types.
- Added legacy alias support for "gemini" in resolvers.
- Added regression test `backend/tests/contracts/test_provider_types.py`.
- Synchronized JSON schemas.

Follow-up to audit master issue #571.

Co-authored-by: arn0ld87 <212052432+arn0ld87@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request centralizes LLM provider types by introducing a dedicated provider_types.py file with constants and a ProviderType literal, replacing hardcoded strings across the backend and updating JSON schemas. Feedback includes suggestions to use the new constants in ALL_PROVIDER_TYPES and error messages for better consistency, as well as a recommendation to replace the environment-dependent grep command in tests with a cross-platform Python implementation.

Comment thread backend/app/contracts/provider_types.py
if provider is None:
raise ValueError(
"llm_provider.provider must be one of: default, google, openai, custom_openai"
f"llm_provider.provider must be one of: default, {PROVIDER_GOOGLE}, {PROVIDER_OPENAI}, custom_openai"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The error message still contains a hardcoded string custom_openai. Since the goal of this PR is to centralize provider types, consider using a constant for this internal runtime identifier as well to ensure consistency across the codebase.

References
  1. Use a single canonical source or function to determine entity types or categories across all database operations to ensure consistency and avoid discrepancies.

Comment on lines +15 to +19
cmd = [
"grep", "-r", "\"gemini\"", str(app_root)
]

result = subprocess.run(cmd, capture_output=True, text=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using subprocess.run with grep makes the test suite dependent on the host environment (e.g., it will fail on Windows without a Unix-like shell). It is better to implement this check using pure Python with pathlib.Path.rglob and string searching to ensure portability across different operating systems, consistent with our cross-platform compatibility guidelines.

References
  1. When implementing platform-specific logic, provide cross-platform fallbacks to maintain compatibility across different operating systems.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
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.

bug(provider): provider="gemini" literal vs "google" consumers — Gemini secrets/models invisible

1 participant