From d1f669939d41e0053705780b8c00fd85a332dd05 Mon Sep 17 00:00:00 2001 From: miguelgfierro Date: Thu, 28 May 2026 10:36:21 +0200 Subject: [PATCH] fix(pipeline): assert result narrowed in invoke return path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the try/finally introduced in #240, pyright could not narrow result: StatePipelineResult | None to StatePipelineResult at the return statement (a finally block can reassign, so the narrowing must be local). Add an explicit assert before return — same runtime guarantee, makes the non-None invariant visible to pyright. --- fireflyframework_agentic/pipeline/state_pipeline.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fireflyframework_agentic/pipeline/state_pipeline.py b/fireflyframework_agentic/pipeline/state_pipeline.py index c31b8e21..57a1cc0b 100644 --- a/fireflyframework_agentic/pipeline/state_pipeline.py +++ b/fireflyframework_agentic/pipeline/state_pipeline.py @@ -649,6 +649,7 @@ async def invoke( success = result.success if result is not None else False await self._emit("on_pipeline_complete", self._name, run_id, success, duration_ms) + assert result is not None # set in try-block before reaching here return result async def _run_fanout(