CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
test(tracing): restore MCP provider stack after unregister-failure test (codex review)
xf gongb8ea8a8eaacb
diff --git a/tests/tracing/test_trace_scope.py b/tests/tracing/test_trace_scope.pyindex 70cfda6..1da7132 100644--- a/tests/tracing/test_trace_scope.py+++ b/tests/tracing/test_trace_scope.py@@ -176,8 +176,10 @@ async def test_trace_swallows_mcp_unregister_failure(monkeypatch):# Real attach registers the MCP provider; make unregister blow up on detach.# The body must still run and the failure must not propagate.agent, _provider, tracer = _build()+ import cubepi.mcp._tracing as mcp_tracing++ baseline = len(mcp_tracing._provider_stack)try:- import cubepi.mcp._tracing as mcp_tracingdef _boom(_token): # noqa: ANN202raise RuntimeError("unregister boom")@@ -189,6 +191,9 @@ async def test_trace_swallows_mcp_unregister_failure(monkeypatch):ran = Trueassert ran, "body must run even when MCP unregister fails on detach"finally:+ # The patched unregister raised before popping, so restore the+ # module-level provider stack to avoid polluting later tests.+ del mcp_tracing._provider_stack[baseline:]await tracer.shutdown()