Repository navigation
fix(gemini): preserve multipart thought summaries - #2831
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Accumulate thought text llm/transformer/gemini/outbound_convert.go, llm/transformer/gemini/outbound_stream_test.go |
Thought text parts append to accumulated reasoning content. Tests check that response and streaming transformations combine thought text while keeping ordinary text separate, and preserve candidate content, finish reasons, and usage counts. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Suggested reviewers: looplj
Merge Risk: 
Minimal · up to 9d8e8
-
Multipart reasoning summaries should be preserved. No merge-blocking risk was identified; CI remains pending.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull details: Docstring Coverage
-
Explanation
Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
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.
[Medium impact] The PR appears safe to merge. SummaryPreserves every thought-text part in source order instead of keeping only the last part.
Reviews (1) · Last reviewed commit: "fix(gemini): preserve multipart thought ..." · Reviewed by Greptile |
- chore: sync model developers data (looplj#2829) - feat: add provider quota state change webhook events (looplj#2828) - chore(deps): bump @google/genai in /integration_test/gemini/node (looplj#2837) - chore(deps): bump @hookform/resolvers from 5.2.2 to 6.0.2 in /frontend (looplj#2835) - chore(deps): bump google.golang.org/genai in /integration_test/gemini (looplj#2836) - chore(deps): bump js-cookie from 3.0.7 to 3.0.8 in /frontend (looplj#2834) - chore(deps): bump @radix-ui/react-tabs from 1.1.13 to 1.2.1 in /frontend (looplj#2833) - chore(deps): bump @radix-ui/react-separator in /frontend (looplj#2832) - fix(openai): preserve explicit image response format (looplj#2838) - fix(gemini): preserve multipart thought summaries (looplj#2831) - chore(deps): bump github.com/jackc/pgx/v5 in / (looplj#2818) - chore(deps): bump github.com/aws/aws-sdk-go-v2/config in / (looplj#2816) - chore(deps): bump github.com/openai/openai-go/v3 (looplj#2815) - chore(deps): bump github.com/redis/go-redis/v9 in / (looplj#2820) - fix(gql): preserve dashboard helpers during generation (looplj#2830) - fix(anthropic): apply repaired tool input in stream aggregation (looplj#2827) - fix(gemini): map blocked finish reasons to content_filter (looplj#2826) - feat(overrides): delete fields across request body arrays (looplj#2824) - chore(deps): bump github.com/aws/aws-sdk-go-v2/credentials in / (looplj#2817) - fix(gemini): accept GenerateContent field aliases (looplj#2798) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
When one Gemini candidate contains several
thought: truetext parts, response conversion overwrites the accumulated reasoning with each part. Clients receive only the final summary fragment in both normal responses and streaming chunks.Change
Concatenate thought text in source order in the shared response converter. The regression exercises the public response and stream interfaces with multiple parts, interleaved answer text, Unicode, an empty thought part, a separate candidate, and a subsequent streaming chunk.
This follows Google's documented iteration and accumulation of thought summaries.
Validation
make test-backend-all(root and llm modules).cd llm && go test -race ./transformer/gemini -count=1.pnpm --dir frontend test:unit.go tool govulncheck ./...in both root and llm modules: no reachable vulnerabilities; each scan notes one advisory in a required module whose affected code is not called.git diff --check.The new regression fails in both modes before the fix and passes afterward. Per
AGENTS.md, build and lint commands were not run locally; remote CI is pending.Prepared with AI assistance and independently reviewed.
Summary by CodeRabbit