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

+3 -3
View File
@@ -98,7 +98,7 @@ async def test_empty_compact_finishes_silently_and_does_not_schedule_idle_archiv
session.add_message("assistant", "Nothing to compact.", _command=True)
loop.sessions.save(session)
completions = []
loop.runtime_events.subscribe(completions.append, TurnCompleted)
loop.bus.subscribe(completions.append, TurnCompleted)
await loop._dispatch(InboundMessage(
channel="websocket", sender_id="user", chat_id="test", content="/compact",
@@ -155,7 +155,7 @@ async def test_stop_completes_a_compact_command_waiting_for_the_session_lock(loo
metadata={"webui_turn_id": "queued-compact"},
)
completions = []
loop.runtime_events.subscribe(completions.append, TurnCompleted)
loop.bus.subscribe(completions.append, TurnCompleted)
async with loop._get_session_lock(key):
await loop._dispatch_command_inline(msg, key, msg.content, loop.commands.dispatch)
reply = await cmd_stop(CommandContext(
@@ -181,7 +181,7 @@ async def test_stop_finishes_inflight_compaction_as_cancelled(loop) -> None:
loop.provider.chat_with_retry.side_effect = wait_for_cancel
completions = []
loop.runtime_events.subscribe(completions.append, TurnCompleted)
loop.bus.subscribe(completions.append, TurnCompleted)
msg = InboundMessage(
channel="websocket", sender_id="user", chat_id="test", content="/compact",
metadata={"webui_turn_id": "compact-turn"},