Skip to content

CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.

fix(providers): flatten uncovered branches in stream-error guards

xf gong41fd765130c8
diff --git a/cubepi/providers/anthropic.py b/cubepi/providers/anthropic.py
index 2313413..d120c18 100644
--- a/cubepi/providers/anthropic.py
+++ b/cubepi/providers/anthropic.py
@@ -313,8 +313,7 @@ class AnthropicProvider(BaseProvider):
# _convert_response, _assemble_response).
if type(_sdk_exc).__module__.startswith("anthropic"):
classify_and_raise(_sdk_exc, model=model, messages=messages)
- else:
- raise
+ raise
except BaseException as e:
exc = e
diff --git a/tests/providers/test_openai.py b/tests/providers/test_openai.py
index a8d052c..fbb5465 100644
--- a/tests/providers/test_openai.py
+++ b/tests/providers/test_openai.py
@@ -945,6 +945,8 @@ class TestOpenAIStreamMultipleToolCalls:
class _FakeSdkExc(Exception):
"""Minimal fake SDK exception with configurable status_code."""
+ __module__ = "openai" # so the __module__ guard in classify_and_raise allows it
+
def __init__(self, message: str, *, status_code: int | None = None) -> None:
super().__init__(message)
if status_code is not None: