refactor(events): unify scoped runtime notifications across clients (#5670)

* refactor(events): unify scoped runtime notifications across clients

* style(tests): sort auto-compaction event imports

* refactor(events): scope connections and remove retry callback plumbing

* docs: remove runtime notification design write-up

* refactor(bus): route operation events through the message bus

* fix(channels): isolate outbound sends by destination

* style(events): group shared notification imports

* refactor(events): converge runtime and hook delivery on MessageBus

* test(events): migrate fixtures to unified message bus
This commit is contained in:
chengyongru authored and GitHub committed 2026-09-06 02:11:19 +08:00
1 parent 3495281282
commit 192e2e90dc
78 files changed
+1620 -1194

No files matched your search

+8 -4
View File
@@ -1281,9 +1281,10 @@ async def test_runner_accumulates_usage_and_preserves_cache_reads():
@pytest.mark.asyncio
async def test_runner_binds_on_retry_wait_callback():
"""Provider retry heartbeats use the explicitly supplied callback."""
async def test_runner_carries_retry_notifications_in_provider_context():
"""The runner carries a generic scope, not an event-specific callback."""
from nanobot.agent.runner import AgentRunner
from nanobot.events import EventSink, RetryWaitEvent
captured: dict = {}
@@ -1308,10 +1309,13 @@ async def test_runner_binds_on_retry_wait_callback():
model="test-model",
max_iterations=1,
max_tool_result_chars=_MAX_TOOL_RESULT_CHARS,
retry_wait_callback=retry_wait_cb,
events=EventSink(retry_wait_cb),
))
assert captured["on_retry_wait"] is retry_wait_cb
assert "on_retry_wait" not in captured
event = RetryWaitEvent("waiting")
await captured["provider_context"].events.emit(event)
retry_wait_cb.assert_awaited_once_with(event)
# ---------------------------------------------------------------------------