fix(antigravity): always include text field in thought parts to prevent Google 500#2252
fix(antigravity): always include text field in thought parts to prevent Google 500#2252sususu98 wants to merge 1 commit intorouter-for-me:devfrom
Conversation
…nt Google 500 When Claude sends redacted thinking with empty text, the translator was omitting the "text" field from thought parts. Google Antigravity API requires this field, causing 500 "Unknown Error" responses. Verified: 129/129 error logs with empty thought → 500, 0/97 success logs had empty thought. After fix: 0 new "Unknown Error" 500s.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical issue where the Google Antigravity API returned 500 'Unknown Error' responses. The problem stemmed from the API's strict requirement for a 'text' field within thought parts, which was previously omitted when Claude sent redacted thinking with empty text. The change ensures this field is consistently present, thereby stabilizing API interactions and preventing these errors. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request addresses a 500 error from the Google Antigravity API by ensuring the text field is always included in thought parts, even when the thinking text is empty. The change removes the conditional that previously omitted the field for empty text. The fix is consistent with the problem description and correctly resolves the issue.
xkonjin
left a comment
There was a problem hiding this comment.
Code Review
Summary: Always includes the text field in thought parts sent to Google Antigravity API, even when empty. Prevents Google 500 errors from missing required fields.
Issues Found
🐛 Indentation regression (blocking)
The entire thinking-block handling section (lines ~107-160) has been re-indented from tabs to mixed spaces, breaking the Go formatting convention used throughout this file. The functional change is a single-line removal of the conditional:
// Before: text was conditional
if thinkingText != "" {
partJSON, _ = sjson.SetBytes(partJSON, "text", thinkingText)
}
// After: text is always set (the actual fix)
partJSON, _ = sjson.SetBytes(partJSON, "text", thinkingText)The fix itself is correct and minimal, but the surrounding whitespace changes make the diff 5x larger than needed and introduce inconsistent indentation (spaces where the rest of the file uses tabs). Please run gofmt or goimports on this file and split the formatting into a separate commit, or revert the whitespace-only changes.
✅ Logic is sound
- Unconditionally setting
text(even to"") is the right fix for the Google API requirement. - No behavioral change to signature validation or unsigned-block dropping.
Verdict
The one-line fix is correct and addresses a real production issue. The whitespace noise should be cleaned up before merge to keep blame/history useful.
Summary
When Claude sends redacted thinking with empty text (
"thinking": ""), the translator omits the"text"field from thought parts. Google Antigravity API requires this field, causing 500 "Unknown Error" responses.Root Cause
In
antigravity_claude_request.go, the thought block construction had a conditional:This produces
{"thought": true, "thoughtSignature": "..."}without a"text"field when thinking text is empty (redacted thinking). Google's API fails to parse this and returns a generic 500.Fix
Always include the
"text"field, even when empty:Verification
Analyzed 270 log files (173 error + 97 success):
After deploying the fix: 0 new "Unknown Error" 500s observed, confirming the root cause.