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.
This commit is contained in:
can1357
2026-06-08 22:31:26 +02:00
parent 0089811129
commit 5e6a001f5e
+7
View File
@@ -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={