fix(serve): include tool_result content in GET /messages#122
Merged
emal-avala merged 1 commit intomainfrom Apr 15, 2026
Merged
Conversation
This commit was in PR #117's branch but got lost during squash-merge: the merge happened before the commit made it to the base ref, so only the format+prompt tweaks landed. The L1 test therefore still fails on main (confirmed by the v0.15.1 release e2e run 24442335126 at L1), and API consumers of /messages still can't see tool output. Reapply the fix: - handle_messages now extracts ContentBlock::ToolResult content from user messages (in addition to ContentBlock::Text). API consumers can now inspect what tools returned via /messages. Response shape unchanged. - Revert L1 prompt to the natural "tell me its contents" — no longer depends on the assistant echoing file content verbatim. Verified locally by re-running the full e2e suite on a branch with this change (24442163173: 73/73 passing with gpt-5-mini).
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
Reapplies the `handle_messages` tool_result fix that was in PR #117's branch but lost during the squash-merge. The squash picked up only the format and prompt-tweak commits that existed at merge time; the server-side fix I pushed afterwards stayed on the branch, never reached main, and the v0.15.1 release e2e run subsequently failed at L1.
Run that confirmed the loss: https://github.com/avala-ai/agent-code/actions/runs/24442335126/job/71410098632
The fix
`handle_messages` in `serve.rs`
Extract `ContentBlock::ToolResult` content from user messages in addition to `ContentBlock::Text`. Previously tool output was stripped from `/messages` entirely — a real UX bug for any API consumer wanting to see what tools returned.
Response shape is unchanged: tool output is concatenated into the same string field alongside any user text, separated by newlines.
L1 e2e prompt
Revert back to the natural "Read the file … and tell me its contents" since the marker now lands in `/messages` via the tool_result block regardless of whether the assistant paraphrases. The "reply with ONLY the exact contents" workaround from PR #117 was a symptom of the server bug, not a real fix.
Verification
The earlier e2e run on the branch that had this fix passed 73/73 with gpt-5-mini (run 24442163173 at 07:44 UTC). That's what proved the fix works — unfortunately the branch state at squash-merge time was already stale.
Test plan