diff --git a/gateway/run_topics.py b/gateway/run_topics.py index 06be67b11e..05b6abf70a 100644 --- a/gateway/run_topics.py +++ b/gateway/run_topics.py @@ -435,11 +435,8 @@ class GatewayTopicThreadsMixin: copied_source = source with suppress(Exception): copied_source = dataclasses.replace(source) - # ``dataclasses.replace`` intentionally copies only declared fields. - # Preserve the in-process transport-owner ref that build_source() - # stamps on live inbound events; multiplex routed profiles need it - # for side effects such as Discord thread rename, because the - # runtime profile may not own the Discord adapter/token. + # Keep the live transport owner; multiplex routes may run under a + # profile that does not own the Discord adapter/token. transport_ref = getattr(source, "_transport_adapter_ref", None) if transport_ref is not None: setattr(copied_source, "_transport_adapter_ref", transport_ref) diff --git a/tests/gateway/test_session_title_rename_lane.py b/tests/gateway/test_session_title_rename_lane.py index 84f97571d1..f1008b9748 100644 --- a/tests/gateway/test_session_title_rename_lane.py +++ b/tests/gateway/test_session_title_rename_lane.py @@ -119,8 +119,6 @@ def test_title_thread_copy_preserves_transport_adapter_ref(monkeypatch): return None def fake_schedule(coro, loop, logger=None, log_message=None): - # The test only inspects the source passed into make_coro; close the - # coroutine so pytest does not warn about an unawaited object. coro.close() return None