From 5e6a001f5e57bcedebdd62a3e4cc0ec1698317c1 Mon Sep 17 00:00:00 2001 From: can1357 Date: Mon, 8 Jun 2026 22:31:26 +0200 Subject: [PATCH] fix(python/robomp): raised runtime errors for agent stopReason=error - In _run_rpc_blocking, added a check for an assistant_message stopReason after timeout handling. - When stopReason is "error", the worker now reads errorMessage (or a default message) and raises a RuntimeError. --- python/robomp/src/worker.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/python/robomp/src/worker.py b/python/robomp/src/worker.py index d0a6f03e2..2e281bfae 100644 --- a/python/robomp/src/worker.py +++ b/python/robomp/src/worker.py @@ -654,6 +654,13 @@ def _run_rpc_blocking( hard_timer.cancel() if hard_timeout_fired.is_set(): raise TimeoutError("omp task exceeded hard timeout") + if turn is not None and turn.assistant_message is not None: + stop_reason = turn.assistant_message.get("stopReason") + if stop_reason == "error": + error_msg = turn.assistant_message.get("errorMessage") or "model returned error" + raise RuntimeError( + f"omp agent error (stopReason=error): {error_msg}" + ) log.info( "rpc_done", extra={