fix(channels): retain scheduled results across pre-send outages

This commit is contained in:
Xubin Ren committed 2026-10-17 12:49:03 +08:00
1 parent 61db036cee
commit 508cedff31
31 files changed
+768 -61

No files matched your search

+7
View File
@@ -9,6 +9,7 @@ from copy import deepcopy
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, cast
from nanobot.bus.delivery import DeliveryRequest
from nanobot.bus.events import InboundMessage, OutboundMessage
from nanobot.bus.notification_delivery import notification_is_deliverable
from nanobot.bus.outbound_events import (
@@ -341,6 +342,12 @@ class TurnDelivery:
"response_sources": [dataclasses.asdict(self._response_source)],
})
if response.channel != "websocket" or stop_reason != "error":
delivery = DeliveryRequest.from_context(
self.input_message.metadata, self.session_key,
self.delivery_message.session_generation,
)
if delivery is not None:
response = dataclasses.replace(response, delivery=delivery)
await self.bus.publish_outbound(response)
elif self.lifecycle_message.channel == "cli":
await self.bus.publish_outbound(