fix(web): restore app_module lookup in channel _do_stop

PR #3141 dropped the sys/app_module definition in the disconnect path's
_do_stop while switching to _live_channel_manager(), but the next line
still reads _clear_singleton_cache off app_module. That raised NameError
(swallowed by the except), so the singleton cache was never cleared on
disconnect. Restore the app_module lookup so cleanup runs again.

Co-authored-by: cowagent <cow@cowagent.ai>
This commit is contained in:
zhayujieandcowagent committed 2026-09-12 13:31:12 +08:00
1 parent 8cb998270b
commit 61ee3bcbcd
1 file changed
+2
+2
View File
@@ -5893,6 +5893,8 @@ class ChannelsHandler:
def _do_stop():
try:
import sys
app_module = sys.modules.get('__main__') or sys.modules.get('app')
mgr = _live_channel_manager()
clear_fn = getattr(app_module, '_clear_singleton_cache', None) if app_module else None
if mgr: