Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Bedrock/Gemini: one user message per tool result breaks role alternation

Open Beginner friendly
#223 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
backend

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

help wanted

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 each ToolResult.
  • 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 and google_vertex.rs likewise emit one functionResponse turn 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

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from yologdev/yoagent

All issues in yologdev/yoagent

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.