Repository navigation
SWF(bug): preserve Anthropic tool result order - #79
Merged
maplepaladin73 merged 1 commit intoNov 23, 2026
Merged
Conversation
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration
Bot
force-pushed
the
devin/1795398597-anthropic-tool-result-order
branch
from
November 23, 2026 02:27
2cfd225 to
fe11ff3
Compare
4 of 6 tasks
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.
Summary
Anthropic user turns now lower text/image segments and
tool_resultblocks in wire order. A turn containing[tool_result, text]now emitsAssistant → Tool → Userinstead ofAssistant → User → Tool.Root cause: the lowering path accumulated user text/images and tool results separately, then always emitted the aggregated User message before the Tool messages, discarding their relative order.
Test plan
ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo test -p spark-server --bin spark tool_result_then_follow_up_text_splits_into_tool_then_userleft: User, right: Toolatto_ir_blocks.rs:88.1 passed.ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo test -p spark-server --bin spark anthropic::tests— 47 passed.ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo test -p spark-server --bin spark— 3261 passed, 0 failed, 14 ignored.cargo fmt --all -- --checkATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --tests --all-features -- -Dwarningsbash scripts/check-license-headers.shtyposTry it:
ATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo test -p spark-server --bin spark tool_result_then_follow_up_text_splits_into_tool_then_userNotes for reviewers
Assistant block lowering remains aggregated as before. User blocks now flush pending text/images before each
tool_result, so[text, tool_result]keeps the existingUser → Toolorder while[tool_result, text]becomesTool → User. Tool-result images andis_errorhandling are preserved.Rebased onto
mainafter #80 landed; the only conflict was the adjacent doc-comment bullets, resolved by keeping #80's closed-role wording and this PR's wire-order wording.Untested: live model/GPU behavior and non-Anthropic request surfaces.
CLA
Implemented in session Order Anthropic tool results before follow-up text
Review with Devin · Open in Devin Desktop