local triggers: support mid-turn interruption via origin_metadata {"interrupt": true}
Test Suite / Detect changes (push) Waiting to run
Test Suite / Python (Windows, 3.14) (push) Blocked by required conditions
Test Suite / Python (minimum, 3.11) (push) Blocked by required conditions
Test Suite / Python (latest, 3.14 + coverage) (push) Blocked by required conditions
Test Suite / webui (push) Waiting to run
Test Suite / docker (push) Waiting to run

This commit is contained in:
nanobot
2026-08-03 23:29:14 +08:00
parent 0afdd6cf09
commit c80fc883ba
+9 -1
View File
@@ -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: