Bedrock/Gemini: one user message per tool result breaks role alternation
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Start by reviewing the message construction logic in provider/bedrock.rs (lines ~1282-1320), provider/google.rs (~512-545), and provider/google_vertex.rs to identify where separate same-role messages are emitted for tool results. Implement a small shared helper that appends content blocks to the previous message when it has the same role, then update each builder to use this helper. Add a unit test that builds a request body from an assistant message with 2 tool calls, 2 tool results, and a follow-up steering message, asserting strict role alternation, then run the provider test suite to verify no regressions.
Written by the indexing model from the issue text.
Description
From the 2026-10-05 codebase review (verified for Bedrock, reported for Gemini).
Bedrock
build_bedrock_body(provider/bedrock.rs~1282-1320) pushes a separate{"role":"user"}message for eachToolResult.- Nothing merges adjacent same-role messages.
- The loop and compaction also put user-role messages back to back:
- tool results followed by the stop marker, the loop nudge or a steering message;
- level-2
[Summary]messages.
Converse requires roles to alternate, with all of a turn's toolResults in one message. So the request after any parallel tool call (the default strategy) is expected to fail with a ValidationException. This has stayed invisible because Bedrock has only been tested with mock frames.
Gemini / Vertex
google.rs~512-545 andgoogle_vertex.rslikewise emit onefunctionResponseturn per tool result.- Gemini expects the function responses to match the function calls of the turn.
Fix
In each body builder, append content blocks to the previous message when it has the same role. A shared helper of about 10 lines covers it. Add a test that builds a body from [assistant with 2 tool calls, 2 tool results, a steering message] and asserts strict alternation.
Needs a live run to confirm. No Bedrock or Gemini credentials are available right now.
- Dominant language
- Rust
- Stars
- 327
- Forks
- 46
- Avg merge
- 2h 30m
- Merged PRs (30d)
- 143
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from yologdev/yoagent
-
enhancement P3
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 70/100
yologdev/yoagent#198 · 1 comment ·
Maintainers usually reply within 1 day
-
P3
Difficulty 4/5 3-5 days Newbie friendliness 68/100
yologdev/yoagent#150 · 3 comments ·
Maintainers usually reply within 1 day
All issues in yologdev/yoagent
Similar issues
-
good first issue gpu serve
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
documentation E-easy good first issue help wanted
Difficulty 1/5 1-3 hours Newbie friendliness 91/100
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
charles-hood/DiagramCraft#73 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
ontologyportal/sigma-rs#200 ·
Maintainers usually reply within 1 day