From 891c00c9095a732ecfc0b5dc178ba6dd84c86ad0 Mon Sep 17 00:00:00 2001 From: alliscode Date: Tue, 28 Apr 2026 11:18:22 -0700 Subject: [PATCH] Fix CI lint and mypy issues from prior pivot commit - _workflow.py: collapse nested if (SIM102), drop redundant assignment (RET504) - _declarative_base.py: remove unused last_user_msg = tail assignment whose Message | None type clashed with the prior Message-typed branch Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../agent_framework/_workflows/_workflow.py | 21 +++++++++++-------- .../_workflows/_declarative_base.py | 1 - 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/python/packages/core/agent_framework/_workflows/_workflow.py b/python/packages/core/agent_framework/_workflows/_workflow.py index 22f586faa8..0673132ade 100644 --- a/python/packages/core/agent_framework/_workflows/_workflow.py +++ b/python/packages/core/agent_framework/_workflows/_workflow.py @@ -609,13 +609,17 @@ class Workflow(DictConvertible): # events are intentionally NOT blocked here: a follow-up run with # message=... is the normal way to deliver a response to those # pending requests, e.g. via WorkflowAgent._process_pending_requests.) - if message is not None and checkpoint_id is None and responses is None: - if await self._runner.context.has_messages(): - raise RuntimeError( - "Cannot start a new run with 'message' while in-flight executor " - "messages remain from a prior run. Either resume from a checkpoint " - "(checkpoint_id=...) or wait for the prior run to complete." - ) + if ( + message is not None + and checkpoint_id is None + and responses is None + and await self._runner.context.has_messages() + ): + raise RuntimeError( + "Cannot start a new run with 'message' while in-flight executor " + "messages remain from a prior run. Either resume from a checkpoint " + "(checkpoint_id=...) or wait for the prior run to complete." + ) initial_executor_fn = self._resolve_execution_mode( message, responses, checkpoint_id, checkpoint_storage @@ -719,10 +723,9 @@ class Workflow(DictConvertible): initial_executor_fn = functools.partial(self._send_responses_internal, responses) return initial_executor_fn # Regular run or checkpoint restoration - initial_executor_fn = functools.partial( + return functools.partial( self._execute_with_message_or_checkpoint, message, checkpoint_id, checkpoint_storage ) - return initial_executor_fn async def _restore_and_send_responses( self, diff --git a/python/packages/declarative/agent_framework_declarative/_workflows/_declarative_base.py b/python/packages/declarative/agent_framework_declarative/_workflows/_declarative_base.py index 50016a12d5..c11a03e925 100644 --- a/python/packages/declarative/agent_framework_declarative/_workflows/_declarative_base.py +++ b/python/packages/declarative/agent_framework_declarative/_workflows/_declarative_base.py @@ -954,7 +954,6 @@ class DeclarativeActionExecutor(Executor): last_user_id = ( getattr(tail, "message_id", "") or "" if tail is not None else "" ) - last_user_msg = tail if is_continuation: # Continuation turn: keep prior Conversation.messages intact.