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:
@@ -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={
|
||||
|
||||
Reference in New Issue
Block a user