- test_code_kernel::TestModelFacingReset: reset stays in the schema under a stale kernel_mode and a model-shaped reset call really discards kernel state (#96787). - test_computer_use::TestStartupTimeoutPhaseDetail: cua-driver ready timeout names the wedged phase + doctor hint, and the session stays un-started (#57025/#69372). - test_file_operations::TestEscapeNativeToolArg (windows_only, was FAKE_OS): rg search and the node --check linter get native C:/ paths, not /c/ (#84303). - test_file_tools::TestSSHConfigWriteGate (2): a ~/.ssh/config write goes through the real approval gate, BLOCKED with nobody present / in -q mode, nothing written (#93201). - test_lazy_deps: a newer compatible plugin SDK is satisfied, never re-pinned down (#98407, #86992); windows_only real Matrix probe reports unsupported. - test_mcp_empty_error_message: empty/whitespace exception messages still yield a diagnostic (#19417). - test_mcp_stdio_children_dead: the fast-fail probe never calls the watcher on the plain path, no un-awaited coroutine (#96044). - test_subprocess_utf8_encoding: real _op_whoami survives invalid UTF-8 child output (#53428/#55339). - test_tts_output_timestamp: same-second TTS calls get distinct output files (#43911). - test_windows_agent_loop_papercuts::TestAutocompleteDevicePaths: a relpath ValueError on a device path is skipped, not raised (#42016). - test_windows_native_support::TestCronSchedulerBashResolution (2): cron .sh uses bash from PATH; missing bash is an actionable error, not WinError 2.
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""Regression tests for MCP error messages when str(exc) is empty.
|
|
|
|
Issue #19417: ClosedResourceError (and similar exceptions raised without a
|
|
message argument) produced ``MCP call failed: ClosedResourceError: `` with
|
|
nothing after the colon, making debugging impossible.
|
|
|
|
Fix: ``_exc_str()`` falls back to ``repr(exc)`` when ``str(exc)`` is empty.
|
|
"""
|
|
|
|
from tools.mcp_tool_common import _exc_str
|
|
|
|
|
|
class _EmptyMessageError(Exception):
|
|
"""Exception whose __str__ returns empty string (like anyio.ClosedResourceError)."""
|
|
|
|
def __str__(self):
|
|
return ""
|
|
|
|
|
|
def test_exc_str_falls_back_to_repr_when_message_is_empty():
|
|
"""The #19417 shape: an empty-message exception must still yield diagnostics."""
|
|
text = _exc_str(_EmptyMessageError())
|
|
assert text.strip(), "empty exception message must not produce an empty diagnostic"
|
|
assert "_EmptyMessageError" in text
|
|
|
|
|
|
def test_exc_str_falls_back_for_whitespace_only_message():
|
|
text = _exc_str(RuntimeError(" "))
|
|
assert "RuntimeError" in text
|
|
|
|
|
|
def test_exc_str_keeps_real_message():
|
|
assert _exc_str(ValueError("connection refused")) == "connection refused"
|