From a406d0dbad8aea8362acd9d77838e40b7cf21ffc Mon Sep 17 00:00:00 2001 From: Morgan Wowk Date: Mon, 17 Aug 2026 17:16:46 -0700 Subject: [PATCH] fix(tests): reset OTel tracer provider to None to stop cross-test recursion The reset_otel_providers autouse fixture reset the global tracer provider to a fresh ProxyTracerProvider() after each test. A ProxyTracerProvider delegates get_tracer() to the module-global trace._TRACER_PROVIDER; once that global *is* a ProxyTracerProvider, the delegation points back at itself and start_as_current_span recurses until RecursionError. Because the fixture mutates OTel's process-global state, the broken provider leaked out of the opentelemetry test package into the rest of the suite. Later tests that emit spans (orchestrator_tracing, execution_tracing) hit the RecursionError inside operation_span; the orchestrator swallowed it as a processing error, so container executions were driven to SYSTEM_ERROR instead of their expected states. This surfaced as 6 unrelated-looking failures in test_container_execution_refresh_retries and test_orchestrator_failed_log_upload only when the full suite ran. Reset to None (matching the meter-provider reset on the next line) so get_tracer_provider() falls back to the internal proxy and ProxyTracer resolves to the no-op tracer. Full suite: 468 passed. --- tests/instrumentation/opentelemetry/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/instrumentation/opentelemetry/conftest.py b/tests/instrumentation/opentelemetry/conftest.py index 91541792..bc192cb5 100644 --- a/tests/instrumentation/opentelemetry/conftest.py +++ b/tests/instrumentation/opentelemetry/conftest.py @@ -13,6 +13,6 @@ def reset_otel_providers(): """ yield trace._TRACER_PROVIDER_SET_ONCE._done = False - trace._TRACER_PROVIDER = trace.ProxyTracerProvider() + trace._TRACER_PROVIDER = None otel_metrics._internal._METER_PROVIDER_SET_ONCE._done = False otel_metrics._internal._METER_PROVIDER = None