Skip to content

Fix: Update deprecated Gemini model and error logging for silent bot response failures. - #411

Open
syedbarkath980 wants to merge 1 commit into
AOSSIE-Org:mainfrom
syedbarkath980:fix-gemini-model-deprecated
Open

Fix: Update deprecated Gemini model and error logging for silent bot response failures.#411
syedbarkath980 wants to merge 1 commit into
AOSSIE-Org:mainfrom
syedbarkath980:fix-gemini-model-deprecated

Conversation

@syedbarkath980

@syedbarkath980 syedbarkath980 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Problem

Vs-bot debate responses and judging were failing silently, returning generic personality-flavored fallback messages instead of real AI-generated responses — even with a valid and correctly configured Gemini API key.

There were two separate issues contributing to the problem.


Root Cause

1. Gemini errors were silently swallowed

GenerateBotResponse discarded the actual Gemini error and returned a hardcoded, in-character fallback message instead.

For example, when the Rookie Rick bot's Gemini request failed, the user would receive:

Uh, wait a sec! Like, I totally blanked out, you know? My bad, kinda like that time at Cousin Joey's BBQ!

This fallback is defined per bot in personalityErrorResponse:

case "Rookie Rick":
    return fmt.Sprintf(
        "%s Like, I totally blanked out, you know? My bad, kinda like that time at Cousin Joey's BBQ!",
        catchphrase,
    )

The issue was inconsistent with JudgeDebate in the same file, which already logs Gemini errors:

// JudgeDebate — logs the error
if err != nil {
    log.Printf("Gemini error: %v", err)
}

Whereas GenerateBotResponse previously did this:

// GenerateBotResponse — error was not logged
if err != nil {
    return personalityErrorResponse(botName, "A glitch in my logic, there is.")
}

As a result, the underlying Gemini failure was completely invisible in the server logs.

Every request still returned a 200 OK with a plausible-looking, in-character response, making the failure appear to be normal application behavior.

The actual error only became visible after temporary debug logging was added to GenerateBotResponse.


2. Deprecated Gemini model

Once the underlying error was exposed, the actual failure was identified as a 404 from Google:

Error 404: This model models/gemini-2.5-flash is no longer available to
new users. Please update your code to use models/gemini-3.6-flash for
the latest features and improvements.
improper ai response

The project was using the hardcoded model:

gemini-2.5-flash

This model is no longer available to new Gemini API keys, meaning new contributors setting up the project with a freshly created API key could encounter the same failure.


Fix

Two changes were made:

Error logging

Added error logging in case of failure for Gemini API errors in GenerateBotResponse

This brings GenerateBotResponse in line with the existing error-handling behavior in JudgeDebate.

Gemini model update

Updated the default Gemini model:

- const defaultGeminiModel = "gemini-2.5-flash"
+ const defaultGeminiModel = "gemini-3.6-flash"

NOTE: Needs Clarification for the Existing users with 2.5 version:

Google's error message specifically states that gemini-2.5-flash is "no longer available to new users."

This may imply that existing API keys or deployments could still be able to use the older model. I wasn't able to verify this independently because testing was performed with a newly created Gemini API key.

Therefore, if an existing deployment is currently relying on gemini-2.5-flash, this model change could potentially affect it as well.

This is being called out explicitly rather than assuming that existing users are unaffected.


Before

Vs-bot returned generic personality-specific fallback messages instead of actual debate responses:

"Uh, wait a sec! Like, I totally blanked out, you know?
My bad, kinda like that time at Cousin Joey's BBQ!"

The Gemini failure was also not visible in the server logs.

improper.ai.response.before-fix.mp4

After

Vs-bot successfully returns contextual, AI-generated debate responses using the updated Gemini model.

improper.ai.response.after-fix.mp4

Summary by CodeRabbit

  • Bug Fixes
    • Improved error visibility when AI-generated debate responses fail.
    • Updated the default AI model used to generate responses.

@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1671bd34-34b3-4fc1-816c-93632643c4b3

📥 Commits

Reviewing files that changed from the base of the PR and between dfd6b75 and 8516d06.

📒 Files selected for processing (2)
  • backend/services/debatevsbot.go
  • backend/services/gemini.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The default Gemini model changed to gemini-3.6-flash. GenerateBotResponse now logs Gemini generation errors before returning its existing fallback response.

Changes

Gemini response handling

Layer / File(s) Summary
Model selection and error logging
backend/services/gemini.go, backend/services/debatevsbot.go
The default model uses gemini-3.6-flash. GenerateBotResponse logs generation errors with log.Printf before returning the personality-specific fallback response.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 8516d

This localized change updates the default Gemini model and improves visibility into failed responses; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies both main changes: updating the deprecated Gemini model and adding error logging for bot response failures.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Ri1tik

Ri1tik commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

@syedbarkath980 Good Catch but I have never seen such msg till now.

@syedbarkath980

syedbarkath980 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

No, that message was shown AFTER i added a log line: log.Printf("❌ Gemini error in GenerateBotResponse: %v", err) in GenerateBotResponse function which was not present before i made the change. It is added to catch and show the error thrown by gemini in case of any issue caused by the gemini api.

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.

2 participants