test(e2e): assert codex called the long-named mcp tool, not just any tool

This commit is contained in:
ryan-crabbe-berri 2026-11-02 23:28:57 -08:00
parent 6b24d1f429
commit 8394895e97

View file

@ -6,6 +6,7 @@ from typing import Final
import pytest
from codex.harness import CodexHarness, McpServer
from codex.run import McpCall
from codex.setups import ModelSetup, with_expected_failure
from e2e_config import unique_marker
@ -19,8 +20,7 @@ LONG_TOOL_NAME: Final = "read_the_current_secret_value_from_the_vault_that_this_
"deployment",
with_expected_failure(
"claude_bedrock",
reason="LiteLLM passes Codex's namespaced MCP tool name to Bedrock uncapped and Bedrock rejects tool names over"
" 64 characters, failing every turn (LIT-10289)",
reason="LiteLLM sends Bedrock Converse a tool name over 64 characters, which it rejects (LIT-10289)",
),
)
class TestCodexLongMcpToolName:
@ -28,16 +28,14 @@ class TestCodexLongMcpToolName:
marker: Final = unique_marker()
secret: Final = codex.home / "secret.txt"
_ = secret.write_text(marker)
vault: Final = McpServer(
command=sys.executable,
args=(str(MCP_SERVER),),
env={"SECRET_FILE": str(secret), "TOOL_NAME": LONG_TOOL_NAME},
)
codex.add_mcp_server("vault", vault)
env: Final = {"SECRET_FILE": str(secret), "TOOL_NAME": LONG_TOOL_NAME}
codex.add_mcp_server("vault", McpServer(command=sys.executable, args=(str(MCP_SERVER),), env=env))
run: Final = codex.exec(
f"Call the {LONG_TOOL_NAME} tool of the vault MCP server, then reply with exactly what it returned.",
model=setup.model,
cwd=codex.new_workspace(files={}),
)
assert any(marker in call.output for call in run.mcp_calls), run
assert McpCall(server="vault", tool=LONG_TOOL_NAME, output=marker) in run.mcp_calls, run
assert marker in run.answer, run