Repository navigation
fix(provider): Bedrock compaction works after a tool call; tool_dispatch bench completes again - #242
Merged
lg2m merged 3 commits intoOct 5, 2026
Conversation
The bench's provider answered the turn after a tool result with a bare unmetered completion. Since #196 the run loop treats that as a swallowed gateway fault and retries it, so the bench never finished. The fixture now answers with text. It moves to tests/support/read_tool.rs, shared with a new integration test that runs one bench iteration under a 10 s timeout, so a fixture that stops completing fails CI instead of hanging the bench. Linear: ENG-1003
…used a tool
Converse rejects any request holding tool-use or tool-result blocks
unless it declares tools: "The toolConfig field must be defined when
using toolUse and toolResult content blocks". Both compaction summarizers
send exactly that: the session's tool history, with no tools. So on
native bedrock/, neither /compact nor automatic in-run compaction worked
for a session that had made one tool call, and long sessions failed once
the context filled.
The Bedrock codec now renders tool blocks as text on a request that
declares no tools, for example "[tool call: read_file {...}]" and
"[tool result from read_file]". The model reads the same history and
cannot call anything. Requests with tools keep their blocks, so the
cached prefix is unchanged. The other codecs are untouched: those APIs
accept tool blocks without tools.
Verified live on bedrock/ Claude Haiku 4.5: one read_file call, then
CompactSession over qq serve. main fails the compaction run with the
error above; this completes it.
Linear: ENG-1002
…ssage; review nits (ENG-1002) Review follow-up: the compaction sentence sat inside the budget-final passage, so its next sentence read as if it applied to summaries. Stale 'dropping the tools is rejected' reasoning in bedrock.rs and the ToolChoice doc now names the cached prefix and native tool blocks. Result labels take the first call with an id. The between-run /compact test asserts the summary still carries tool blocks. Mantle's Anthropic path, checked live, accepts tool blocks without tools. Linear: ENG-1002
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linear: ENG-1002, ENG-1003 · Base: #240 (AP3b), on #238.
What changes for users
On native
bedrock/, compaction now works in sessions that have used a tool. Onmain, both/compactand automatic in-run compaction fail as soon as the session has made one tool call:A long Bedrock session therefore could not recover once its context filled.
Verified live on 2026-10-02: one
read_filecall, thenCompactSessionoverqq serve, with isolated data and runtime directories.mainbedrock/us.anthropic.claude-haiku-4-5…failed(the error above)completedbedrock-mantle/anthropic.claude-sonnet-5maincompleted(no codec change: Mantle's Anthropic path accepts tool blocks without tools)The
tool_dispatchbenchmark runs again (ENG-1003). It has hung since #196.Design
/compact(claim.rswith.without_tools()) and the in-run summary (CompiledAgentPlan::summarize).[tool call: read_file {"path":"config.ron"}],[tool result from read_file]and[tool error from …]. The model reads the same history and cannot call anything.ToolChoice::None: that would charge tool-schema bytes to every summarizer request on every provider, and the summarizer budget would have to reserve them.Completed. Since fix(runtime): treat an empty completion after tool results as a provider fault #196 the run loop retries that shape as a swallowed gateway fault, so the bench never finished.tests/support/read_tool.rs, shared via#[path](the same pattern asturn_overhead) with a new integration test that runs one bench iteration under a 10 s timeout. A fixture that stops completing now fails CI instead of silently hanging the bench.Verification
a_request_without_tools_sends_its_tool_history_as_text. With no tools, every block is text, labels match their calls, an unmatched result id is handled, and the cache point is kept. With tools, the same history keeps its native blocks.compact_session_is_refused_while_active…;one_run_spanning_several_windows….the_tool_dispatch_bench_run_completestimes out with the old fixture and passes with the new one.cargo bench -p qq-core --bench tool_dispatchreportsread_tool_loop: ~62 µs/iteration.cargo test --workspace: 2068 passed;qq-provider --no-default-features --features test-support): 210 passed;--all-targets --all-features -D warnings) and fmt are clean.Review
An independent read-only review approved. Its should-fixes are done:
First-party Anthropic is not checked live (no key in this environment). If it ever rejects tool blocks without tools, the same rendering applies.
Compatibility
Retained live evidence — 2026-10-04
The earlier live results above are the original author's report. This readiness pass found no raw provider request/response or session receipt in the PR comments, associated Linear issue attachments/comments, or the plan ledger; they have not been independently reproduced. No paid provider call or new Devin session was made. First-party Anthropic remains unverified; the old “no key” note describes the author's environment, not a current credential diagnosis. The implemented Converse-only text rendering is the documented choice over ENG-1002's initial declare-tools option.
Feature flow
flowchart LR A["Compaction history includes tool blocks"] --> B{"Bedrock request declares tools?"} B -->|No| C["Render tool history as labelled text"] B -->|Yes| D["Keep native tool blocks and cache shape"] C --> E["Summarizer request"] D --> E