Repository navigation
fix: fall back when Grok returns no usable translation - #2585
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Grok result validation and fallback packages/atmosphere/src/helpers/translate-grok.ts, test/twitter.translation.test.ts |
The helper warns and returns null for non-string or blank Grok text. Tests cover fallback to Polyglot, retention of valid Grok text, and behavior when fallback is unavailable or only the quote translation is empty. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk: 
Minimal · previous review f23cb
-
Grok responses with empty or unusable translation text now fall back to the existing provider instead of being published as empty translations. No merge-blocking risk is apparent.
Pre-merge checks | 
4 | 
1
-
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
A rabbit checks the words that came,
Blank text gets sent back all the same.
Polyglot steps in when needed,
Good Grok lines pass through unimpeded.
A quote finds words; the body stays,
The rabbit hops through translated days.
Comment @coderabbitai help to get the list of available commands.
[Medium impact] The PR appears safe to merge. SummaryThe PR rejects Grok responses that lack usable translation text.
|
Grok can return a non-null response without usable
result.text. The processor then publishes an empty translation, setsdidTranslate = true, and skips the configured Polyglot/AI fallback. This also affects quoted posts.Validate the response at the Grok helper boundary and return
nullfor missing, non-string, empty, or whitespace-only text. Valid Grok responses are preserved. Existing fallback selection continues to handle rejected responses, and the helper logs a warning for the unusable result.Observed on 2026-10-12:
/status/2109439315570999598/zhreturned a valid Grok body translation but an embedded quote translation withprovider: "grok"andtext: "". This patch fixes the false-success handling; it does not claim to fix the underlying X/Grok service failure or translate poll choices.Validation:
npm run build:atmosphereandnpm run build-localpassed.git diff --checkpassed.src/embed/status.ts:8andpackages/atmosphere/src/providers/twitter/processor.ts:986.Summary by CodeRabbit
Bug Fixes
Tests