mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-14 04:02:26 +00:00
fix(gateway): preserve thread routing from cached live session sources
This commit is contained in:
parent
5bf12eb44a
commit
176b93575a
4 changed files with 90 additions and 0 deletions
|
|
@ -603,3 +603,23 @@ async def test_send_restart_notification_logs_info_on_sendresult_success(
|
|||
f"got records: {[(r.levelname, r.getMessage()) for r in caplog.records]}"
|
||||
)
|
||||
assert not notify_path.exists()
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_shutdown_notifications_use_cached_live_thread_source_when_origin_missing():
|
||||
runner, adapter = make_restart_runner()
|
||||
source = make_restart_source(chat_id="parent-42", chat_type="group", thread_id="topic-7")
|
||||
session_key = build_session_key(source)
|
||||
|
||||
runner._running_agents[session_key] = object()
|
||||
runner.session_store._entries[session_key] = MagicMock(origin=None)
|
||||
runner._cache_session_source(session_key, source)
|
||||
adapter.send = AsyncMock(return_value=SendResult(success=True, message_id="shutdown"))
|
||||
|
||||
await runner._notify_active_sessions_of_shutdown()
|
||||
|
||||
adapter.send.assert_awaited_once_with(
|
||||
"parent-42",
|
||||
"⚠️ Gateway shutting down — Your current task will be interrupted.",
|
||||
metadata={"thread_id": "topic-7"},
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue