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
fix(providers): classify stream-level SDK errors in outer except handlers
xf gong9fc98760a1a5
diff --git a/cubepi/providers/openai.py b/cubepi/providers/openai.pyindex b7ab76d..2b87bda 100644--- a/cubepi/providers/openai.py+++ b/cubepi/providers/openai.py@@ -509,7 +509,17 @@ class OpenAIProvider(BaseProvider):except BaseException as e:exc = e- err_text = self._error_message(e, model)+ # Classify SDK stream-level errors that the narrow create()+ # try/except didn't catch — async-for-chunk iteration errors+ # (mid-stream connection drops, timeouts) arrive here raw.+ if isinstance(e, Exception):+ from cubepi.errors import classify_and_raise++ try:+ classify_and_raise(e, model=model, messages=messages)+ except Exception as _classified:+ exc = _classified+ err_text = self._error_message(exc, model)error_msg = AssistantMessage(content=[],stop_reason="error",diff --git a/cubepi/providers/openai_responses.py b/cubepi/providers/openai_responses.pyindex cff637c..fac69e8 100644--- a/cubepi/providers/openai_responses.py+++ b/cubepi/providers/openai_responses.py@@ -580,7 +580,17 @@ class OpenAIResponsesProvider(BaseProvider):except BaseException as e:exc = e- err_text = self._error_message(e, model)+ # Classify SDK stream-level errors that the narrow create()+ # try/except didn't catch — async-for-event iteration errors+ # arrive here raw.+ if isinstance(e, Exception):+ from cubepi.errors import classify_and_raise++ try:+ classify_and_raise(e, model=model, messages=messages)+ except Exception as _classified:+ exc = _classified+ err_text = self._error_message(exc, model)error_msg = AssistantMessage(content=[],stop_reason="error",