Skip to content

test(mcp): assert runner emits tool_call_output_item on MCP failures#2556

Open
OiPunk wants to merge 1 commit intoopenai:mainfrom
OiPunk:codex/openai-agents-879-runner-tool-output-assert
Open

test(mcp): assert runner emits tool_call_output_item on MCP failures#2556
OiPunk wants to merge 1 commit intoopenai:mainfrom
OiPunk:codex/openai-agents-879-runner-tool-output-assert

Conversation

@OiPunk
Copy link
Contributor

@OiPunk OiPunk commented Feb 27, 2026

Summary

This is a follow-up to #2554, adjusted based on maintainer feedback.

Instead of only asserting that the run continues, this test now explicitly verifies that runner-level MCP tool failures are surfaced as a generated tool_call_output_item.

What changed

  • Added test_runner_emits_mcp_error_tool_call_output_item in tests/mcp/test_runner_calls_mcp.py.
  • Introduced a crashing fake MCP server for deterministic failure behavior.
  • Asserted both sync and streaming paths:
    • a tool_call_output_item is produced
    • the item output matches the expected error text from default_tool_error_function
    • the run still continues to the next turn (final_output == "done")

Validation

Locally run:

  • env -u all_proxy -u ALL_PROXY -u http_proxy -u HTTP_PROXY -u https_proxy -u HTTPS_PROXY -u no_proxy -u NO_PROXY uv run --with pytest pytest -q tests/mcp/test_runner_calls_mcp.py
  • uv run --with ruff ruff check tests/mcp/test_runner_calls_mcp.py
  • uv run --with mypy mypy tests/mcp/test_runner_calls_mcp.py

All passed locally.

@github-actions github-actions bot added documentation Improvements or additions to documentation feature:mcp labels Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature:mcp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant