diff --git a/nanobot/triggers/local_turns.py b/nanobot/triggers/local_turns.py index a468d42e..63f429f7 100644 --- a/nanobot/triggers/local_turns.py +++ b/nanobot/triggers/local_turns.py @@ -44,7 +44,15 @@ def _should_defer_local_trigger_turn( session_key: str, active_session_keys: Iterable[str], ) -> bool: - return local_trigger(msg.metadata) is not None and session_key in active_session_keys + if not (local_trigger(msg.metadata) is not None and session_key in active_session_keys): + return False + # Mid-turn interruption requested: the trigger was created with + # origin_metadata {"interrupt": true} (copied verbatim into msg.metadata + # by the local runner). Skip deferral so the message routes into the + # session's pending queue and is injected at the next tool-call boundary. + if msg.metadata.get("interrupt"): + return False + return True def _local_trigger_id(msg: InboundMessage) -> str | None: