From 2d8f19349c8e874bcd0ec6bcee22dbfe2fc3f27b Mon Sep 17 00:00:00 2001 From: Jer Miller Date: Fri, 20 Mar 2026 15:50:27 -0600 Subject: [PATCH] Fix todos:todo agent crash from string output_path Dream scheduler sends output_path as a raw string in the request dict, but _run_agent and related functions call .exists() on it expecting a Path object. Coerce output_path to Path at all four read sites. Co-Authored-By: Claude Opus 4.6 (1M context) --- think/agents.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/think/agents.py b/think/agents.py index 897d3d6e9..b4de6851f 100644 --- a/think/agents.py +++ b/think/agents.py @@ -746,7 +746,7 @@ def _build_dry_run_event(config: dict, before_values: dict) -> dict: event["transcript"] = transcript event["transcript_chars"] = len(transcript) event["transcript_files"] = sum(config.get("source_counts", {}).values()) - output_path = config.get("output_path") + output_path = Path(config["output_path"]) if config.get("output_path") else None if output_path: event["output_path"] = str(output_path) @@ -796,7 +796,7 @@ async def _execute_with_tools( from .providers import PROVIDER_REGISTRY, get_provider_module provider = config.get("provider", "google") - output_path = config.get("output_path") + output_path = Path(config["output_path"]) if config.get("output_path") else None if provider not in PROVIDER_REGISTRY: valid = ", ".join(sorted(PROVIDER_REGISTRY.keys())) @@ -910,7 +910,7 @@ async def _execute_generate( system_instruction = ( f"{system_instruction}\n\n{extra_ctx}" if system_instruction else extra_ctx ) - output_path = config.get("output_path") + output_path = Path(config["output_path"]) if config.get("output_path") else None output_format = config.get("output") # Get generation parameters from config (set in frontmatter) @@ -1052,7 +1052,7 @@ async def _run_agent( model = config.get("model") is_cogitate = config["type"] == "cogitate" refresh = config.get("refresh", False) - output_path = config.get("output_path") + output_path = Path(config["output_path"]) if config.get("output_path") else None # Emit start event start_event: dict[str, Any] = { -- 2.51.2