Skip to content

Add integration coverage for file_editor image observations in Responses API #1950

Closed as not planned

Description

@enyst

Summary

The existing integration test t08_image_file_viewing exercises FileEditor image viewing, but it only validates the final model response. The bug fixed in PR #1895 happens earlier: tool-role serialization for Responses API dropped ImageContent, so the LLM never received the image from file_editor tool observations. We should extend the integration test to explicitly assert that tool-role image content is serialized into Responses input items as input_image for tool observations.

Proposed approach

Update tests/integration/tests/t08_image_file_viewing.py to add a structural assertion during/after the run:

  1. After the run, iterate self.llm_messages (captured MessageEvent LLM messages).
  2. Find the first tool-role message for FileEditorTool (or any tool message) whose content includes ImageContent (from file_editor.view).
  3. Serialize that Message using Message.to_responses_dict(vision_enabled=True) or via LLM.format_messages_for_responses and verify:
    • There is a message item with content containing at least one input_image entry (and no base64 in output text).
    • There is a corresponding function_call_output item with the same call_id (minimal output text) so call_id threading remains intact.

If we prefer to keep the integration test black-box, add a smaller unit test in tests/sdk/test_message_responses.py (or similar) that constructs a tool Message with ImageContent and validates the Responses serialization matches the new behavior. However, reusing the integration test keeps the coverage closer to the real tool path.

Sketch (integration test)

# after run
from openhands.sdk.llm import Message, ImageContent

# find tool message with ImageContent
image_tool_msg = next(
    m for m in self.llm_messages
    if m['role'] == 'tool' and any(c.get('type') == 'image' for c in m['content'])
)
message = Message.model_validate(image_tool_msg)
items = message.to_responses_dict(vision_enabled=True)

assert any(
    i.get('type') == 'message' and any(p.get('type') == 'input_image' for p in i.get('content', []))
    for i in items
)
assert any(i.get('type') == 'function_call_output' for i in items)

Acceptance criteria

Activity

  1. added
    llm
    and removed on Feb 6, 2026
  2. added
    behavior-initiative
    and removed
    behavior-initiative
    on Feb 14, 2026
  3. all-hands-bot commented on Mar 27, 2026

    @all-hands-bot
    Collaborator

    This issue is stale because it has been open for 40 days with no activity. Remove the stale label or leave a comment, otherwise it will be closed in 10 days.

  4. all-hands-bot commented on Apr 6, 2026

    @all-hands-bot
    Collaborator

    This issue was automatically closed due to 50 days of inactivity. We do this to help keep the issues somewhat manageable and focus on active issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stalellmtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions