Skip to content

fix(serve): include tool_result content in GET /messages#122

Merged
emal-avala merged 1 commit intomainfrom
fix/serve-include-tool-result
Apr 15, 2026
Merged

fix(serve): include tool_result content in GET /messages#122
emal-avala merged 1 commit intomainfrom
fix/serve-include-tool-result

Conversation

@emal-avala
Copy link
Copy Markdown
Member

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

  • `bash -n` syntax check
  • Verified e2e green on branch (run 24442163173: 73/73)
  • Re-run release-e2e on this branch after merge → expect 73/73

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).
@emal-avala emal-avala merged commit 7612646 into main Apr 15, 2026
14 of 15 checks passed
@emal-avala emal-avala deleted the fix/serve-include-tool-result branch April 15, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant