Skip to content

OpenAI Responses translator drops text beside tool_result blocks #8

Description

@LPFchan

Summary

The OpenAI Responses request translator silently drops non-tool_result blocks when an Anthropic user message contains at least one tool_result.

Claude Code can combine a tool result and subsequent user guidance into one user message to preserve role alternation. In that case, the tool output reaches the provider but the accompanying text or image does not. This can make corrective prompts and Claude Code's no-visible-output recovery prompt disappear while the model continues the previous task.

Reproduction

Translate this Anthropic message through anthropic_to_responses:

{
  "messages": [{
    "role": "user",
    "content": [
      {
        "type": "tool_result",
        "tool_use_id": "call_1",
        "content": "result"
      },
      {
        "type": "text",
        "text": "Now reply visibly"
      }
    ]
  }]
}

Actual behavior

The translated Responses input contains only:

{
  "type": "function_call_output",
  "call_id": "call_1",
  "output": "result"
}

The text block is discarded.

Expected behavior

Each tool_result should become a function_call_output, while supported sibling text/image blocks should remain in role: "user" message items in source order.

Root cause

In src/proxy/translate/responses.rs, the user-message path detects whether any block is a tool_result. When true, that branch processes only tool_result blocks and never converts its siblings. The Chat Completions translator already preserves mixed content.

Affected version

Confirmed in v0.2.4 and downstream build v0.2.4-fork.2.

A patch with regression coverage for mixed text, image, multiple tool results, and ordering will follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions