diff --git a/cron/scheduler.py b/cron/scheduler.py index 61d5537d9..e7a22dfbe 100644 --- a/cron/scheduler.py +++ b/cron/scheduler.py @@ -972,6 +972,12 @@ def run_job(job: dict) -> tuple[bool, str, str, Optional[str]]: f"— last activity: {_last_desc}" ) + # Guard against non-dict returns from run_conversation under error conditions + if not isinstance(result, dict): + raise RuntimeError( + f"agent.run_conversation returned {type(result).__name__} instead of dict: {result!r}" + ) + final_response = result.get("final_response", "") or "" # Strip leaked placeholder text that upstream may inject on empty completions. if final_response.strip() == "(No response generated)":